I’m successfully running the following actionscript:
parameter "Application"="{if ((exists keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" whose (exists values whose (name of it as lowercase = "application") of it) of registry)) then ((value "Application" of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" of registry) as string) else if ((exists keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" whose (exists values whose (name of it as lowercase = "applicaton") of it) of registry)) then ((value "Applicaton" of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" of registry) as string) else ("Not Found")}"
parameter "Location"="{if ((exists keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" whose (exists values whose (name of it as lowercase = "location") of it) of registry)) then ((value "Location" of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" of registry) as string) else ("Not Found")}"
parameter "Environment"="{if ((exists keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" whose (exists values whose (name of it as lowercase = "environment") of it) of registry)) then ((value "Environment" of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" of registry) as string) else ("Not Found")}"
parameter "Support"="{if ((exists keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" whose (exists values whose (name of it as lowercase = "managed by") of it) of registry)) then ((value "Managed By" of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" of registry) as string) else ("Not Found")}"
createfile until __EOF
Application:{parameter "Application"}
Location:{parameter "Location"}
Environment:{parameter "Environment"}
Support:{parameter "Support"}
__EOF
copy __createfile {pathname of parent folder of data folder of client & "\my-file"}
I have tested this on 2 machines (after validating in the fixlet debugger) and it runs fine, but reports as failed because the relevance still evaluates to true. This is because somehow, BigFix can not see the file that is created. I am not able to see the file via Windows Explorer or a command prompt, however, if I type the full path (C:\Program Files (x86)\BigFix Enterprise\BES Client\my-file) in to the Windows Explorer address bar, I am prompted for a program to open the file. Choosing Notepad here allows me to see that the file was correctly written.
I feel like I’m missing a permissions step perhaps, but since my day-to-day administration isn’t on Windows, I’m not positive where I should begin. Any ideas?
Do you have User Account Control (UAC) turned on? The BigFix folder has permissions set that remove the “Users” group, so you should only be able to view it when “Elevated” to your administrator credentials (which is probably the case in the your command prompt, but not in Windows Explorer). That would explain seeing the file only on the command line.
What is the Relevance that is evaluating to true? I only see the actionscript in your post, being able to see the Relevance would be necessary.
exists keys "HKLM\System\CurrentControlSet\Software\CompanyName\Servers" of native registry
Relevance 3:
not exists file "my-file" of parent folder of data folder of client
Thanks for taking a look at this. I’m not sure if UAC is on, but I’ll see if I can figure out how to tell and let you know. Just to clarify, I am not able to see the file via the command prompt nor in Windows Explorer. However, in Windows Explorer, if I click navigate to “C:\Program Files (x86)\BigFix Enterprise\BES Client” then type in the “\my-file” into the address bar, I am prompted for an application to open the file, and notepad will open the file and the expected content is there.
If UAC is turned on, Windows Explorer shouldn’t be able to browse to C:\Program Files (x86)\BigFix Enterprise\BES Client, instead you’d get a pop-up “You currently don’t have permission to access this folder”
This does indeed look like a string case. Maybe the file isn’t being copied with correct permissions? From a command prompt, try listing the permissions on the file and see what that looks like. The “cacls” command can do this, ie.
start->Run, "cmd.exe"
cd C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData
cacls my-file
Should give something like
C:\Program Files (x86)\BigFix Enterprise\BES Client\my-file BUILTIN\Administrators:F
NT AUTHORITY\SYSTEM:F
NT AUTHORITY\SYSTEM:F
Well, well, well. So, I opened the file again and noticed that the Notepad title was ‘Program - Notepad’. So, I got to thinking, perhaps the file isn’t really my-file at all, but perhaps named Program. Sure enough, that relevance writes the file to ‘C:\Program’ with the proper contents…Sooo, am I missing something in how to copy __createfile to a path that contains spaces?
(it as string) of values "Application" of keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" of registries
Or this will return Not Found:
( (it as string) of value "Application" of keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Software\CompanyName\Servers" of registries ) | "Not Found"
You generally don’t need IF/THEN/ELSE at all if you write the relevance just so.