Let's say I have an instance WindowsIdentityand you want to get the groups in which it belongs. To get the list, I use the following code:
WindowsIdentity identity = null;
identity.Groups.Translate(typeof(NTAccount)).Select(x => x.Value);
I get something like this:
"BUILTIN\\Administrators"
"BUILTIN\\Users"
"NT AUTHORITY\\INTERACTIVE"
"CONSOLE LOGON"
I have a local group (say, MYSPECIALGROUP) that has BUILTIN\\Administratorsas its member. MYSPECIALGROUPnot returned in the example above. How to get all groups, including nested ones?
source
share