Here's my code:
var b = WindowsPrincipal.Current.IsInRole(@"TEST\YYY Setup Group"); var ba = WindowsPrincipal.Current.IsInRole(@"BUILTIN\Administrators"); WindowsIdentity id = WindowsIdentity.GetCurrent(); WindowsPrincipal wPrincipal = new WindowsPrincipal(id); bool st = wPrincipal.IsInRole(@"TEST\YYY Setup Group"); bool sta = wPrincipal.IsInRole(@"BUILTIN\Administrators");
My current user is not an administrator but a member of local admins (he was assigned there via Local Users and Computers) and domain group TEST\YYY Setup Groups. Why do I getb = false, ba = false, but st = true and sta = false?