title: Redirect standard output and prompt for UAC with ProcessStartInfo
body: <p>I'm working on a WPF application targeting .NET 3.0. I need to call an exe which requires administrative privileges. I can get the UAC to prompt for permission by using something like:</p>
  
  <pre><code>ProcessStartInfo startInfo = new ProcessStartInfo();
  startInfo.Verb = "runas";
  startInfo.UseShellExecute = true;
  startInfo.FileName = "target.exe";
  
  Process p = new Process();
  p.StartInfo = startInfo;
  p.Start();
  </code></pre>
  
  <p>My problem is I need to redirect standard output, and doing so with <code>UseShellExecute = true</code> results in an exception stating that: </p>
  
  <blockquote>
    <p>The Process object must have the UseShellExecute property set to false
    in order to redirect IO streams</p>
  </blockquote>
  
  <p>However, setting it to false results in the UAC not prompting for permission and I get an exception stating:</p>
  
  <blockquote>
    <p>The requested operation requires elevation</p>
  </blockquote>
  
  <p>How can I redirect standard output and prompt for UAC?</p>
  
  <p>I have seen <a href="https://stackoverflow.com/questions/3596259/elevating-privileges-doesnt-work-with-useshellexecute-false">this similar question</a>, however the solution is to use the app.manifest to give my application administrative privileges. This is something I cannot do due to requirements.</p>