Skip to content

Instantly share code, notes, and snippets.

@rstackhouse
Created August 4, 2011 13:35
Show Gist options
  • Save rstackhouse/1125157 to your computer and use it in GitHub Desktop.
Save rstackhouse/1125157 to your computer and use it in GitHub Desktop.
List names of groups of user in C#
var user = System.Security.Principal.WindowsIdentity.GetCurrent();
foreach(var group in user.Groups)
{
var x =group.Translate(typeof(System.Security.Principal.NTAccount));
Console.Out.WriteLine(x.Value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment