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
Solved

PsExec returns different error code when run from PERL

Posted on 2007-03-29
1
1,940 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Resolve DNS query failed errors for Exchange
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

839 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