Capture Return Code from PsExex?

Hi all,

i have a FB Project that remotely installs a software. For this i copy the software to the remote maschine and execute it using PsExec.
More often than not this process fails on a certain machine. PSExec returns (in the log)

“The handle is invalid” along with RC 6.

I then go (manually) and stop and delete the PSEXESVC on the remote machine, reboot it and then it works again, until it happens again.

This gets tiring, so i though i capture the RC and then just have FB stop and remove the service, reboot the machine and continue afterwards.

But how do i capture the RC? I found no way to write this to a variable. I am quite new to FB so i might have overlooked other possibilites.

Are there other ways of executing “Remote”? Running PowerShell maybe? Any experiences on that?

Thanks a lot
Holger

Grrr, PsExeC!

The PSExec action has a Script event, OnCheckErrorCode which has a ReturnCode parameter.

Very cool, Thanks.

for those who look how to do this with PowerShell, this is what has worked for me

$FBVariables.SetVariable(“ReturnCode”, $ReturnCode)

“ReturnCode” = FinalBuilder Variable
$ReturnCode = Variable set from Script.