C# start a application as admin with password
I am new to programming with C# and am looking for an answer. I have already looked around on this website, but I'm not entirely sure how to do it. For my work I am developing a desktop application to restart devices / drivers in Windows 10. I do this with devcon, but when i start devcon as a administrator it asks for a username and password. I know the username and password, but it will not start as a admin. The code below works, but asks for admin login details.
//Test Devcon with admin rights Process proc = new Process(); ProcessStartInfo PSI = new ProcessStartInfo(@"C:\Devon\devcon.exe"); PSI.WindowStyle = ProcessWindowStyle.Hidden; PSI.UseShellExecute = true; PSI.Verb = "runas"; proc.StartInfo = PSI; proc.Start(); // Disable WIFI PSI.Arguments = (@"disable *VEN_168C"); Process.Start(PSI); System.Threading.Thread.Sleep(3000); //Enable WIFI PSI.Arguments = (@"enable *VEN_168C"); Process.Start(PSI);