title: Starting another process with elevation using different user credentials
body: <p>I'm trying to start an elevated process from with a non-elevated process, but I also need to supply the username and password for a user with administrative credentials. I've tried both the <code>"runas"</code> method for elevation as well as using a manifest, but both yield different errors.</p>
  
  <p>For example, if I do this (without using a manifest that requires elevation):</p>
  
  <pre><code>ProcessStartInfo info = new ProcessStartInfo(path);
  
  info.UseShellExecute = false;
  info.UserName = username;
  info.Password = securePwd;
  info.Domain = "MyDomain";
  info.Verb = "runas";
  
  var proc = Process.Start(info);
  </code></pre>
  
  <p>The process launches without displaying the UAC confirmation dialog and fails upon trying to execute the command that requires administrator permissions (I'm just trying to write a test file to the Program Files directory).</p>
  
  <p>If I add a manifest to the target application that indicates that it requires elevation, then I get a <code>Win32Exception</code> stating that the operation requires elevation.</p>
  
  <p>The issue seems to be setting <code>UseShellExecute</code> to <code>false</code>(as both approaches work fine when this is not the case), but I have to set it to false in order to launch the process under a different user account.</p>
  
  <p><strong>How can I launch an elevated process from a non-elevated process and supply the username and password manually?</strong></p>
  
  <p><strong>BOUNTY EDIT:</strong> While the user cannot be required to <em>enter</em> administrator credentials, a UAC nag dialog is perfectly acceptable. I'm not looking to bypass UAC here.</p>