Getting Group Memberships

by May 23, 2012

If you'd like to know in which groups you are member, here's a simple piece of code that returns the list of groups you belong to:

PS> $User=[System.Security.Principal.WindowsIdentity]::GetCurrent()
PS> $User.Groups | 
ForEach-Object { $_.Translate([System.Security.Principal.NTAccount]).Value } |
Sort-Object

Twitter This Tip! ReTweet this Tip!