?
Solved

PsExec returns different error code when run from PERL

Posted on 2007-03-29
1
Medium Priority
?
1,966 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 1500 total points
ID: 18819042
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to count occurrences of each item in an array.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month17 days, 2 hours left to enroll

864 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