Exit Code Problem

Hi,

I use version 9.2.6.94 of IBM Bigfix,

When I run the script on cmd I get rc = 10 But when I run it on bigfix I get RC = 0 So I can not get the right result on console. I run this job on 24 machines, but only 1 machine is returning wrong value.

Any ideas on the subject? Thanks for your help

–When run with cmd

run:“C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe” -noprofile -executionpolicy bypass -file “C:\aktar\pgm\PaktarTool.ps1” \server\43a971edfead379c556a0cfbc35ac51f\packet.zip

Error :Package record not found.

run : %errorlevel%

‘10’ is not recognized as an internal or external command,operable program or batch file.

–When I run with bigfix

Code

action parameter query “PaketAdi” with description “Paket-Adi FullPath Giriniz”
//============================================================================
//THIS TASK WILL DOWNLOAD AND EXECUTE A POWERSHELL SCRIPT
//============================================================================
if {exist file “C:\IEM\Tools\vgmetadata.cre”}
parameter “PowerShellexe” = "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe"
waithidden “{parameter “PowerShellexe”}” -noprofile -executionpolicy bypass -file "{(value of setting “IEM_PKTAKTAR” of client)}\MapDrive.ps1"
waithidden “{parameter “PowerShellexe”}” -noprofile -executionpolicy bypass -file “{(value of setting “IEM_PKTAKTAR” of client)}\PaktarTool.ps1” {parameter “PaketAdi”}
endif
//============================================================================
setting “Last_action_RC”={(exit code of action)} on “{now}” for client
exit {(value of setting “Last_action_RC” of client)}

LOG

Command succeeded (Exit Code=0) waithidden “C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe” -noprofile -executionpolicy bypass -file “D:\aktar\pgm\MapDrive.ps1” (action:40390)
At 16:38:39 +0300 - actionsite (http://bigfixServer/cgi-bin/bfgather.exe/actionsite)
Command started - waithidden “C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe” -noprofile -executionpolicy bypass -file “C:\aktar\pgm\PaktarTool.ps1” \servera\43a971edfead379c556a0cfbc35ac51f\packet.zip (action:40390)
At 16:38:40 +0300 - actionsite (http://bigfixServer/cgi-bin/bfgather.exe/actionsite)
Command succeeded (Exit Code=0) waithidden
Command succeeded setting “Last_action_RC”=0 on “Thu, 25 May 2017 16:38:41 +0300” for client (action:40390)
Command succeeded (0) exit {(value of setting “Last_action_RC” of client)} (action:40390)

You should get the same command back when you run it exactly the same way.

The main difference could be that its running as Local System when run by BigFix?

The other possible issue is that you might be running the 32 bit powershell as “C:\WINDOWS\system32” when run on the client will actually go to “C:\WINDOWS\SysWow64” so see if running this in cmd makes a difference.

If so then check out https://developer.bigfix.com/action-script/reference/execution/action-uses-wow64-redirection.html