Joey Joey - 1 year ago 77 Question

Open an external program as Administrator?

I know I can make my program start with admin rights, but how do I open a different program with admin rights programmatically using



How do I open Test.exe as an admin from
I know in the property settings of Test.exe I can choose to "Run as Admin" but I would like to do it from, as Test.exe was just an example and will not be included from my project.

Answer Source

Like @Hans already wrote in his comment, you can start a process with elevated rights by creating a ProcessInfo object and set its relevant properties:

Dim startInfo as new ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.WorkingDirectory = "C:\";
startInfo.FileName = "Test.exe";
startInfo.Verb = "runas";

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download