Solved

PsExec returns different error code when run from PERL

Posted on 2007-03-29
1
1,930 Views
Last Modified: 2013-12-23
Hello,

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,
G
0
Comment
Question by:ghosting
1 Comment
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
Comment Utility
I believe this   http://forum.sysinternals.com/forum_posts.asp?TID=6655&KW=psexec may help you understand why...I had a past episode with using it under vb.net and couldn't get it working (http://www.experts-exchange.com/Q_22009728.html).
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
The viewer will learn how to dynamically set the form action using jQuery.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now