Typically (in Windows 7), installing a program will ask for permission to modify the system. As an administrator, I can give the authorization without supplying a password.
I'm trying to figure out how to take an administrator action (restart IIS) from C# code running as a user who is AN administrator, but the not THE "Administrator" account.
To run a process as elevated you can use the runas verb.
Process elevated = new Process();
elevated.StartInfo.Verb = "runas";
elevated.StartInfo.FileName = "Whatever.exe";
elevated.Start();
For restarting IIS (as mentioned before) use iisreset.
Hope you find this useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With