Action parameter query - action script Command failed (Relevance substitution error

I am running the action script below and the action runs complete until this line
if {(parameter “Asset Category” of action =! “”)} Where I get command failed Relevance Substitution error) action script is below and after that is the log file. Does anyone see what is wrong and if the rest of the statement is correct as I have not gotten past this line.

Action script

delete __appendfile

delete servinfo.reg

appendfile REGEDIT4

action parameter query "Asset Category" with description "Please enter the Asset Category (i.e. EACMS,EAP,PCA,BES Cyber Asset,Cyber Asset,Non-CIP) name you would like to add:" With default ""

if {(parameter "Asset Category" of action =! "")}

appendfile "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\Asset Category"

appendfile "value"="{parameter "Asset Category" of action}"

endif

move __appendfile servinfo.reg

wait regedit -s servinfo.reg

Log File

   Relevant - Asset Tags_02242016 (fixlet:4211)
At 12:47:05 -0800 - 
   ActionLogMessage: (action:4211) Action signature verified for Execution
   ActionLogMessage: (action:4211) starting action
At 12:47:06 -0800 - actionsite (http://itemserver.training.tivoli.edu:52311/cgi-bin/bfgather.exe/actionsite)
   Command succeeded delete __appendfile (action:4211)
   Command succeeded delete No 'C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\CustomSite_NERC_CIP_V5\servinfo.reg' exists to delete, no failure reported (action:4211)
   Command succeeded appendfile REGEDIT4 (action:4211)
   Command succeeded (file created) appendfile REGEDIT4 (action:4211)
   Command succeeded appendfile REGEDIT4 (action:4211)
   Command succeeded action parameter query "Asset Category" with description "Please enter the Asset Category (i.e. EACMS,EAP,PCA,BES Cyber Asset,Cyber Asset,Non-CIP) name you would like to add:" With default "" (action:4211)
   Command failed (Relevance substitution error.) if {parameter "Asset Category" of action =! ""} (action:4211)

Correction to statement and action script the error is on this relevance statement (removed the parenthesis )

if {parameter "Asset Category" of action =! ""}

appendfile "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\Asset Category"

appendfile "value"="{parameter "Asset Category" of action}"

endif

I think you just need to refer to the parameter as:

{parameter "Asset Category"}

without the “of action”.

That is not the correct way of checking for empty string. Should be
if {parameter "Asset Category" of action != ""} (notice the order of ! and =)

1 Like

Have you tried for the check

if { exists parameter "Asset Category" of action }

Thanks everyone as that solved the command failure. However when I run this action to complete with exit code 0 (log below. There is no registry edit showing for this.
Action script

delete __appendfile

delete servinfo.reg

appendfile REGEDIT4

action parameter query "Asset Category" with description "Please 
enter the Asset Category (i.e. EACMS,EAP,PCA,BES Cyber Asset,Cyber 
Asset,Non-CIP) name you would like to add:" With default ""

if {parameter "Asset Category" of action != ""}

appendfile "HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\Asset Category"

appendfile "value"="{parameter "Asset Category" of action}"

endif

move __appendfile servinfo.reg

wait regedit -s servinfo.reg

Logs

At 04:48:09 -0800 - actionsite (http://itemserver.training.tivoli.edu:52311/cgi-bin/bfgather.exe/actionsite)

   Command succeeded delete __appendfile
(action:4213)

   Command succeeded delete No 'C:\Program Files
(x86)\BigFix Enterprise\BES Client\__BESData\CustomSite_NERC_CIP_V5\servinfo.reg'
exists to delete, no failure reported (action:4213)

   Command succeeded appendfile REGEDIT4
(action:4213)

   Command succeeded (file created) appendfile
REGEDIT4 (action:4213)

   Command succeeded appendfile REGEDIT4
(action:4213)

   Command succeeded action parameter query
"Asset Category" with description "Please enter the Asset
Category (i.e. EACMS,EAP,PCA,BES Cyber Asset,Cyber Asset,Non-CIP) name you
would like to add:" With default "" (action:4213)

   Command succeeded appendfile
"HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\Asset
Category" (action:4213)

   Command succeeded appendfile
"value"="EAP" (action:4213)

   Command succeeded move __appendfile servinfo.reg
(action:4213)

   Command started - wait regedit -s servinfo.reg
(action:4213)

At 04:51:07 -0800 - 

   Report posted successfully

At 04:51:08 -0800 - actionsite (http://itemserver.training.tivoli.edu:52311/cgi-bin/bfgather.exe/actionsite)

   Command succeeded (Exit Code=0) wait regedit -s
servinfo.reg (action:4213)

At 04:51:09 -0800 - 

   ActionLogMessage: (action:4213) ending
action

At 04:51:09 -0800 - mailboxsite (http://itemserver.training.tivoli.edu:52311/cgi-bin/bfgather.exe/mailboxsite5113511)

   Not Relevant - Asset Tags_02242016
(fixlet:4213)

I may be approaching this wrong as I need to write to both client settings linux (file based) and windows registry based). I was looking at what happens if you edit a client setting which takes action. IF someone has a better suggestion.

Why don’t you edit the client settings through the console?

From there you can select “More Options…” at the bottom

Now you can input custom settings and target each OS as necessary.

We are building a baseline for new machines that are being added and there are 6 asset tags that are required as well as other fixlets that are to be added to the new machine and actions to be taken.

Yes you should be using the generic client settings actionscript commands so this can be cross platform

https://developer.bigfix.com/action-script/reference/client/setting.html

1 Like

Thanks AlanM. I will give that a shot and post the results. Thanks to all for your help.

Thanks to all that helped the final step is solved.

if {parameter "Asset Category" of action != ""}
    setting "Asset Category"="value"="{parameter "Asset Category" of action}" on "{now}" for client
endif
1 Like

That still doesn’t look right, but you probably have it correct in your actual script.

You should not write directly to the registry or to the file on linux for this. This is exactly what make client settings so powerful is that they are cross platform and you don’t have to worry about the actual implementation details. Instead you can use the generic and supported way to read and write them that is universal as @AlanM pointed out.

Also, there are registry edit action script commands that it is much easier to use than using regedit -s reg.reg