Run an application as other user with UAC
<p>I'm trying to write an application that runs the Draytek VPN client as another user as I don't want the user to have an admin password and their account is a standard user. However I can't get it working due to errors in both implementations I've tried.</p>

<p>Here is some sample code I've tried:</p>

<pre><code>System.Security.SecureString ss = new System.Security.SecureString();
foreach (var c in "password")
{
    ss.AppendChar(c);
}

Process process = new Process();
process.StartInfo.UseShellExecute = true;
process.StartInfo.WorkingDirectory = "c:\\";
process.StartInfo.FileName = @"C:\Program Files (x86)\DrayTek\Smart VPN Client\SmartVPNClient.exe";
process.StartInfo.Verb = "runas";
process.StartInfo.UserName = "testUser";
process.StartInfo.Password = ss;
process.StartInfo.UseShellExecute = false;
process.Start();
</code></pre>

<p>I get the error: <em>The requested operation requires elevation.</em></p>

<p>I have also tried Impersonation using the code in the question, <a href="http://stackoverflow.com/questions/9909784/c-sharp-impersonator">C# Impersonator</a>. My implementation of the call is below:</p>

<pre><code>  using ( new Impersonator( "testUser", "", "password" ) )
  {

      Process process = new Process();
      process.StartInfo.UseShellExecute = true;
      process.StartInfo.WorkingDirectory = "c:\\";
      process.StartInfo.FileName = @"C:\Program Files (x86)\DrayTek\Smart VPN Client\SmartVPNClient.exe";
      process.StartInfo.Verb = "runas";
      process.Start();
  }
</code></pre>

<p>However the error from running the above code is <em>Unknown error (0xfffffffe)</em>.</p>

<p>I can provide more error details if required.</p>
