Tags: | Categories: Code Snippets Posted by Vitaly Zayko on 10/24/2008 11:34 AM | Comments (0)

You have to know this before your App does something that requires Administrator privileges. Actually it is quite easy:

using System.Security.Principal; public bool IsAdmin() { WindowsPrincipal principal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); return principal.IsInRole(WindowsBuiltInRole.Administrator); }

Comments are closed