PsExec returns different error code when run from PERL
Posted on 2007-03-29
I am trying to use PsExec to copy a batch script up to my remote machines, which then copies the needed .exe and .vbs files to the remote machine, executes thems, and ideally returns. I can execute the command from a DOS command prompt no problem, I get an exit code of 0. BUT when I try to execute the command from a PERL script, I get an exit code of 1, and as far as I can tell, the PsExec batch script did run and do it's job. It just returns with an exit code of 1 instead of 0. WHY???
Here's the command I am running for PsExec...
psexec \\remote_machine -s -n 45 -i -c -f "C:\XAOSys\var\www\linepull\config\remote_machine.bat"
even if I try executing PsExec with the -u user -p pwd options instead of -s, I still get an exit code of 1, not 0, when I run it from PERL, but from DOS, it's always exit code 0... I've tried running my batch, vbs, and exe files by hand on the remote machine and there are no errors, so why does it return error code 1???
Any pointers on how to execute PsExec from PERL / scripts in general multiple times without hanging and maintaining proper return codes would be appreciated. I would post on the SysInternals Forum, but they locked the forums due to spam, lame! Get spam filtering guys.
Thanks in advance,