title: appcmd code in C#?
body: <p>I have an web service that run's this:</p>
  
  <pre><code> var Proc = new Process();
                  Proc.StartInfo.FileName = CredentialBatFile;
                  Proc.StartInfo.Arguments = WebSiteName + " " + Apppool_Username 
                                                      + " " + Apppool_Password;
                  Proc.Start();
  </code></pre>
  
  <p>The bat file has:</p>
  
  <pre><code>C:\Windows\system32\inetsrv\appcmd.exe set site "%1" 
                -virtualDirectoryDefaults.userName:%2 
                -virtualDirectoryDefaults.password:%3
  </code></pre>
  
  <p>If I run on localhost (on the server) it works fine. however if I run it on the server from the web service it fails.</p>
  
  <p>Can I achieve the same function as <code>appcmd</code> in pure C# code?</p>
  
  <p><strong>EDIT</strong> </p>
  
  <pre><code>Exception: Unknown error (0xfffffffe) StackTrace: at    
  System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) 
  </code></pre>