WindowsIdentity id = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(id);
bool isRunAsAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
// Если нет прав админа
if (!isRunAsAdmin)
{
ProcessStartInfo proc = new ProcessStartInfo();
proc.UseShellExecute = true;
proc.WorkingDirectory = Environment.CurrentDirectory;
proc.FileName = System.Windows.Forms.Application.ExecutablePath;
proc.Verb = "runas";
proc.Arguments = string.Empty;
try
{
Process.Start(proc);
}
catch
{
}
Application.Current.Shutdown();
}