title: VB.Net - execute vbscript using process with 'run as administrator'
body: <p>I have a vbscript file that I want to run in my vb.net application.  In the application, the script 'must' use a process.  The reason is that it's actually being called from a windows process.  In order for me to execute the vbscript manually, I have to right-click on the shortcut and select 'run as administrator'.</p>
  
  <p>How can I emulate this using vb.net?  Currently the execution works because I tested it with it only creating a text file.  Also, I want to assume that the user is in the administrators group and don't want them to have to login each time because it will execute every minute.</p>
  
  <p>My code:</p>
  
  <pre><code>Dim foo As New System.Diagnostics.Process
  foo.StartInfo.WorkingDirectory = "c:\"
  foo.StartInfo.RedirectStandardOutput = True
  foo.StartInfo.FileName = "cmd.exe"
  foo.StartInfo.Arguments = "%comspec% /C cscript.exe //B //Nologo C:\aaa\test.vbs"
  foo.StartInfo.UseShellExecute = False
  foo.StartInfo.CreateNoWindow = True
  foo.Start()
  foo.WaitForExit()
  foo.Dispose()
  </code></pre>
  
  <p>Thanks.</p>