I wanted to drop a file in there that I will call: exception.sites
Is there a script you can suggest that will check if it exists in any of the usernames on a given system, and then if the file doesn’t, BigFix can download and put the file in that place.
Or if you have another suggestions, would be appreciated.
I found out that this will work to determine if there’s a file in that folder for the logged on user:
exists logged on user AND exists file whose (name of it as lowercase contains “exception.sites”) of folder (“c:\users” & (name of logged on user) & “\AppData\LocalLow\Sun\Java\Deployment\security”)
However, now I just need to know how to get a specific file into that directory that I need help with.
However, how do I still write the script so that the file can be put into the specific logged-in user’s directory? If I do a copy command, still the source I’m not sure where it is if I did a prefetch download. Or can I just list the URL like this:
Look at the very last line in the actionscript of this example to see how to copy a file into a subfolder of the current user folder: http://bigfix.me/fixlet/details/2609
I am also looking to deploy java exceptions, but I have not written that part yet. The analysis is my starting point that is the first link. Please share what you come up with on bigfix.me if you can, feel free to remove any specific URLs. Also you could use a regular prefetch command with a size and sha1 check for your exception.sites download. You would only need to update it if it changes.
Thanks for the response. I am getting a FAILED error when I try to copy the file to the local system’s user’s profile. First, the download looks successful as it says the exception.sites file is complete and cached on server. But then shortly after, I get a FAILED for status.
Here’s what I have as my script:
// Download exception.sites file
begin prefetch block
add nohash prefetch item url=http://URL/exception.sites
end prefetch block
// Record the current user name, so that it does not change during execution
parameter "CurrentUserName" = "{name of current user}"
// only continue if there is exactly 1 user logged on, and it is the same user recorded in the beginning.
continue if {(exists current user) AND (1 = number of logged on users) AND (parameter "CurrentUserName" = name of current user)}
// copy exception.sites file to logged in user's profile
copy "__Download\exception.sites" /VERYSILENT /DIR="c:\Users\{parameter "CurrentUserName"}\AppData\LocalLow\Sun\Java\Deployment\security\"
For the section: // copy exception.sites file to loggged in user’s profile
also, the client log files section for this would be helpful. Also I wonder if there is an issue with your prefetch statement. I have never used the “add nohash” option, but usually you have to specify a destination file name that the file will be saved as.
Try changing your “Continue If” statement to include a check for file existence.
continue if {(exists file “__Download\exception.sites” of parent folder of client) AND (exists current user) AND (1 = number of logged on users) AND (parameter “CurrentUserName” = name of current user)}
This is the script that finally worked. Thanks. Hoping to keep using BigFix more and more. Which means submitting more forum questions.
// Download exception.sites file
begin prefetch block
add nohash prefetch item url=http://URL/exception.sites
end prefetch block
// Record the current user name, so that it does not change during execution
parameter "CurrentUserName" = "{name of current user}"
// only continue if there is exactly 1 user logged on, and it is the same user recorded in the beginning.
// continue if {(exists current user) AND (1 = number of logged on users) AND (parameter "CurrentUserName" = name of current user)}
// copy exception.sites file to logged in user's profile
dos copy "__Download\exception.sites" "c:\Users\{parameter "CurrentUserName"}\AppData\LocalLow\Sun\Java\Deployment\security\"
The
add nohash prefetch
was in the BigFix script documentation PDF I found online:
add nohash prefetch item
Adds a download item to the prefetch queue. This command must reside between a begin prefetch block and an end prefetch block command. This is a singular command – it can only specify a single download at a time. Relevance substitution is not allowed, permitting the BigFix Server to cache the download when the Action is created. If the BigFix Client requests any ordinal files, the Relay will collect them all. The BigFix Client will only download the item if this command is in a TRUE condition block.
You should not require the “dos” before the copy, but that will work. ActionScript has an internal “copy” command, while using the “dos” command sends whatever comes after it to the command prompt, which in this case also understands “copy”.
How about the relevance statement for the Mac? I’m using this to see if the exception.sites file is present in the logged in user’s Java directory.
exists logged on user AND not exists file whose (name of it as lowercase contains “exception.sites”) of folder ("/users/" & (name of logged on user) & “/Application Support/Oracle/Java/Deployment/security”)
But not sure if this is correct even as I am testing it.
This should return all “exception.sites” files from all users:
files “exception.sites” of folders “Application Support/Oracle/Java/Deployment/security” of folders whose(exists folder “Application Support/Oracle/Java/Deployment/security” of it) of folder “/users”
I just need to know if the logged in user has the exception.sites file.
For Mac, does it have to be written the way you had it?
For a logged in user then, would it look like this:
exists logged on user & exists file “exception.sites” of folders “Application Support/Oracle/Java/Deployment/security” of folders whose(exists folder “Application Support/Oracle/Java/Deployment/security” of it) of folder “/users/” & (name of logged on user)
I was coming at it from the reporting angle, while your trying to write actionscript for a task/fixlet it seems. I recommend testing these pieces in an analysis to get a better idea of what you are writing.
exists logged on user & exists file “Application Support/Oracle/Java/Deployment/security/exception.sites” of folder whose(name of it as lowercase contains (name of logged on user as lowercase)) of folder “/users”
I guess I’m not clear on what you are trying to accomplish. Are you trying to report on the current user’s exceptions, or are you trying to give them exceptions if they don’t have any? Or are you trying to check which exceptions they have and overwrite your own if they don’t match?
I’m trying to add an exception.sites file for a logged on user so they don’t have to call me to help them configure Java. We have a single website users access that can’t be used due to upgrading to Java 7 v. 51, so by adding an exception for them in advance, it’s being proactive.
So by finding out if they have Java 7 v. 51, and then whether or not they have an exception.sites file already in the appropriate folder, I can just quickly drop it in there for them without knowing. We only have one user per machine, so that’s why just knowing whether the logged on user has that file is all we need.
One issue with doing this by the current user logged on is that it can only be done if a user is logged on, but not if no user is logged on.
It is possible to have a task that checks for the exception.sites missing from ANY user folder and adds it to ALL user folders missing it by adding it one by one every 15 min or so with a repeating action. This is often easier than trying to target current user, though that is possible.
It sounds like you are currently looking for:
exists logged on user AND not exists file “Application Support/Oracle/Java/Deployment/security/exception.sites” of folder whose(name of it as lowercase contains (name of logged on user as lowercase)) of folder “/users”
How about copying an exception file into the right folder? I’m trying:
// Record the current user name, so that it does not change during execution
parameter "CurrentUserName" = "{name of logged on user}"
// copy exception.sites file to logged in user's profile
copy "__Download\exception.sites" "/Users/{parameter "CurrentUserName"}/Library/Application Support/Oracle/Java/Deployment/Security/"
Doesn’t seem to be working right though. I tried to update what I had for Windows.
move "{posix path of file "exception.sites" of folder "__Download" of client folder of current site}" "/Users/{parameter "CurrentUserName"}/Library/Application Support/Oracle/Java/Deployment/Security/exception.sites""
Guys thanks for all the information in this post. It helped me find a solution to another issue. However, I was unable to use the - parameter “CurrentUserName” = “{name of logged on user}” - which was central to this logic. The package would fail at this point. The debugger would state “No Inspector context”. I suspect this is because the inspector library has been updated and that relevance is not longer used, or that this is a one off problem on only my system :). I am on BES 9.5.2. Can any of you confirm?