[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

PsExec returns different error code when run from PERL

Posted on 2007-03-29
1
Medium Priority
?
1,961 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
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.
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

650 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