I am having trouble reading the output from a process when running several processes from .net. One example is the 'netsh' command.
I am trying to read all scopes from a dhcp server.
It is only failing in web applications and unit tests.
In the below code the 'message' is an empty string.
var arguments = @"-r myDhcpServer.myDomain dhcp server \\myDhcpServer.myDomain show scope";
var startInfo = new ProcessStartInfo("netsh", arguments)
{
    CreateNoWindow = true,
    UseShellExecute = false,
    RedirectStandardOutput = true
};
using (var cmdProcess = Process.Start(startInfo))
{
    var message = cmdProcess.StandardOutput.ReadToEnd();
    Debug.WriteLine(message);
    cmdProcess.WaitForExit();
}
Some points
- running .net 3.5 on VS 2008
 - fails in a web app ie cassini
 - fails in a unit test (using resharper)
 - works from a console app
 - works from a windows app
 - works from the command line
 - used to work in Windows XP
 - I have tried turning off UAC
 - other commands work. for exampl ipconfig
 - I have tried running VS as admin
 - yes i know there are other ways of doing this and am looking into them. but i would still like to know why the process approach does not work.
 
Regards
Simon
Edit:
Turns out it is only on windows 7 64bit
MS Premier support has replicated the issue and is working on a resolution/workaround.