I have the isAdministrator(String a)
as follows:
public static bool IsAdministrator(String aString)
{
WindowsIdentity identity = new WindowsIdentity(a);
WindowsPrincipal principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
Where aString
is a username. When I ran this I realized I need a UPN. Is there anyway around this?
Thanks in advance!