Creating action Scripts

You can create your own action scripts in the IBM BigFix Console by selecting Take Custom action from the Tools menu. This brings up a dialog box where you can set Relevance, the message and more. Click on the action Script tab. In the text window that shows up, you can enter any action script you please. You can embed the results of a Relevance expression anywhere in your script by enclosing it in curly brackets {}.

For instance, you might want to download a file with a command like:

download http://download.bigfix.com/download/bes/60/BESServerUpgrade-6.0.12.5.exe

Then, to make sure it downloaded properly with a secure hash, you could add this command with an embedded Relevance clause:

continue if {(size of it = 18455939 AND sha1 of it = 
"58a879f5b98357c4ec6f5ff7dbe3307eef5ca2ec") of file "BESServerUpgrade-6.0.12.5.exe" 
of folder "__Download"}

This expression compares the length of the file (found by looking in the __Download folder) to a known size. It also compares the sha1 of the file to a known value. This construct allows you to stop execution of the action script if the file was not downloaded properly. This illustrates a common usage of the Relevance language to make an assertion in an action script.

You might want to set a registry key with the results of a Relevance expression:

regset "{"[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess
\Parameters\FirewallPolicy\" & (if (current profile type of firewall = domain 
firewall profile type) then ("DomainProfile") else ("StandardProfile")) & "]"}" 
"EnableFirewall"=dword:00000000

Here, the result of the Relevance expression in the curly brackets is substituted into the name of the registry setting. This example shows how to branch based on the value of an Inspector in order to set a registry with the proper string.

You can also set action variables with the results of Relevance statements. This is done with the parameter command:

parameter "tmpfolder" = "{pathname of folder (value of variable "tmp" of 
environment)}"

Because the Relevance expression used to target the Fixlet is often the same one used in the corresponding action, you are more likely to be solving the right problem. That makes script-writing easier and makes scripts more robust and accurate.