Primoz Primoz - 1 year ago 104
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

Answer Source

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.]

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download