I'd like to run a command with elevated permissions while capturing the output:
using System.Diagnostics;
namespace SO
{
    class Program
    {
        static void Main(string[] args)
        {
            ProcessStartInfo startInfo  = new ProcessStartInfo("FSUTIL", "dirty query c:");
            startInfo.RedirectStandardOutput = true;
            startInfo.UseShellExecute = false;
            startInfo.CreateNoWindow = true;
            startInfo.Verb = "runas";
            var proc = new Process();
            proc.StartInfo = startInfo;
            proc.Start();
            proc.WaitForExit();
            string output = proc.StandardOutput.ReadToEnd();
            System.Console.WriteLine(output);
        }
    }
}
The problem is that startInfo.Verb = "runas"; requires startInfo.UseShellExecute = true;, which is not compatible RedirectStandardOutpu.
Any possible solutions?
 
     
    