Interactive Process (Diskpart.exe) not responding in Windows Server 2003

G

Guest

Code that I have verified to work fine in Windows XP, hangs while running in Server 2003. It’s run under the Administrator account, started from the local hard drive, and has requested FullTrust minimal permissions. Any idea what might be the issue

As a test I used System.Diagnostics.Process to run a “one-liner†command with the following StartInfo settings

MyProcess.StartInfo.Filename = “wimc.cmdâ€;
MyProcess.StartInfo.Arguments = “nicconfig list briefâ€
MyProcess.StartInfo.UseShellExecute = false
MyProcess.StartInfo.RedirectStandardInput = false
MyProcess.StartInfo.RedirectStandardOutput = true

I can Start(), WaitForExit(), and then StandardOutput.ReadToEnd() just fine, to get the text that was sent to the console. This one-liner works great in either XP or Server 2003

But, when I try to work an interactive process such as the diskpart.exe application, the following WORKS in XP, but hangs in Server 2003

MyProcess.StartInfo.FileName = "cmd"
MyProcess.StartInfo.Arguments = "/k"
MyProcess.StartInfo.RedirectStandardOutput = true
MyProcess.StartInfo.RedirectStandardInput = true
MyProcess.StartInfo.CreateNoWindow = true
MyProcess.StartInfo.UseShellExecute = false
MyProcess.Start()
MyProcess.StandardInput.AutoFlush = true
â€
â€
MyProcess.StandardInput.WriteLine("diskpart.exeâ€);
MyProcess.StandardInput.Write(Environment.NewLine)
â€
â€
While(TempCmdOutput.Trim() != “DISKPART>â€

TempCmdOutput = MyProcess.StandardOutput.ReadLine()


As I roll through the while-loop, I can see my diskpart.exe appear at the command-prompt. In Windows XP, I can continue to loop through until I see “DISKPART>â€, allowing me to read the diskpart startup text which is pushed to the console. But, in Windows Server 2003, after I see “diskpart.exe†at the command prompt, ReadLine() just sits there waiting for the diskpart.exe to send back text. After opening up Task Manager, I can see my TestApp.exe, cmd.exe, and diskpart.exe all running under Administrator.

Well, any ideas as to why I can't read the diskpart.exe StandardOutput in Windows Server 2003 would be greatly appreciated.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top