3

Is there any alternative utility to replace PsExec? If I mostly use batch script for automation work. Due to instability of psexec, like hanging/ not responding, I may need another solution. Can the community advise, thanks.

EDIT: I have 2 particular issues with psexec.

  1. https://superuser.com/questions/168706/cant-start-program-by-psexec-on-windows-server-2003-64-bit

  2. I have a ASP.NET web service which only invoking psexec from remote SOAP API calls. Everyday when I check, I can see 10-20 psexec hanging in task manager. During the peak time, the web server receives about 1-5 requests, but it probably lasts for only 5 minutes. Below is my code.


Process psexecProcess = new Process();
ProcessStartInfo psi = new ProcessStartInfo("PsExec.exe");

string psexecArg = "-u " + GetRemoteAccount(serverType) 
+ " -p " + GetRemotePW(serverType) 
+ " \\\\" + GetManagementServerIP(serverType) 
+ " C:\\MyBatchScript.bat " + username;           

//set process options
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.CreateNoWindow = true;
psi.Arguments = psexecArg;  //set psExec command

psexecProcess.StartInfo = psi;
psexecProcess.Start();     //run PsExec

StreamReader reader1 = psexecProcess.StandardError;
string result1 = reader1.ReadToEnd();

StreamReader reader2 = psexecProcess.StandardOutput;
string result2 = reader1.ReadToEnd();

psexecProcess.WaitForExit();

So that why I feel so frustrated with psexec.Can the community help me find anything wrong with both of these issues? Please advise, thanks.

EDIT2: I also need an alternative for 64-bit servers (for Windows Server 2003 64-bit).

  • 3
    What type of instability are you actually seeing? Perhaps you should be asking a question about your psexec issues somewhere? – Zoredache Jan 26 '11 at 22:02
6

PowerShell 2 has the ability to do remote execution of files.

  • Do I need to install PowerShell 2 on both local and remote host? – Stan Feb 28 '11 at 13:56
  • @stan I'm pretty sure that's the case. – sysadmin1138 Feb 28 '11 at 15:20
3

I'm going to second Zoredache's point.PsExec is pretty good at what it does. If something is hanging, it may be the programs that you're calling, and an alternative won't necessarily do any better.

If you're trying to interact (via script) remotely however, then something like Expect is a better solution. Can you provide more details on what you're trying to do?

  • Updated my question. – Stan Jan 29 '11 at 1:34
3

Power Admin recently released PAExec which is supposed to be a PsExec replacement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.