Solved

PsExec returns different error code when run from PERL

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl: How to add backslashes to every period in a string 1 56
perl syntax 3 35
No IP Address Assigned to VM 10 93
Error when Running powershell script 6 31
Resolve DNS query failed errors for Exchange
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

726 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