Primoz Primoz - 7 months ago 34
PowerShell Question

How to get all groups that a user is a member of?


cmdlet returns members of a specific group. Is there a cmdlet or property to get all the groups that a particular user is a member of?

I fixed my mistake:
should be


Get group membership for a user:

$strUserName = "Primoz"
$strUser = get-qaduser -SamAccountName $strUserName

See Get Group Membership for a User

But also see Quest's Free PowerShell Commands for Active Directory.

[Edit: Get-ADPrincipalGroupMembership command is included in Powershell since v2 with Windows 2008 R2. See kstrauss' answer below.]