using System.Security.Principal; bool isElevated; using (WindowsIdentity identity = WindowsIdentity.GetCurrent()) { WindowsPrincipal principal = new WindowsPrincipal(identity); isElevated = principal.IsInRole(WindowsBuiltInRole.Administrator); }
C# administrator privilege - checking Archive du 10/05/2011 le 29/04/2020