title: Why does Process.Start throw Win32Exception if using different user credentials?
body: <p>I need to start a process as another user and it's bombing.  </p>
  
  <p>I scaled it down my code to a simple reference example.  This code works fine to start the process itself:</p>
  
  <pre><code>        var info = new ProcessStartInfo("notepad.exe")
                         {
                             UseShellExecute = false,
                             RedirectStandardInput = true,
                             RedirectStandardError = true,
                             RedirectStandardOutput = true
                         };
  </code></pre>
  
  <p>However, if I add the <code>UserName</code> and <code>Password</code> values:</p>
  
  <pre><code>       var info = new ProcessStartInfo("notepad.exe")
                         {
                             UserName = "user",
                             Password = StringToSecureString("password"),
                             UseShellExecute = false,
                             RedirectStandardInput = true,
                             RedirectStandardError = true,
                             RedirectStandardOutput = true
                         };
          Process.Start(info);
  </code></pre>
  
  <p>It bombs with the ever so helpful System.ComponentModel.Win32Exception message:</p>
  
  <blockquote>
    <p>The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.</p>
  </blockquote>
  
  <p>Just in case, here is the secure string conversion method:</p>
  
  <pre><code>    private static SecureString StringToSecureString(string s)
      {
          var secure = new SecureString();
          foreach (var c in s.ToCharArray())
          {
              secure.AppendChar(c);
          }
          return secure;
      }
  </code></pre>
  
  <p>Any ideas or alternate solutions would be very much appreciated! </p>