Elevating process privilege programmatically?

This code puts the above all together and restarts the current wpf app with admin privs: if (IsAdministrator() == false) { // Restart program and run as admin var exeName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; ProcessStartInfo startInfo = new ProcessStartInfo(exeName); startInfo.Verb = “runas”; System.Diagnostics.Process.Start(startInfo); Application.Current.Shutdown(); return; } private static bool IsAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal … Read more