Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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. http://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).

share|improve this question
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
add comment

3 Answers

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

share|improve this answer
    
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
add comment

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?

share|improve this answer
    
Updated my question. –  Stan Jan 29 '11 at 1:34
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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