Display ADGroups of a User (Memberof)

From the GUI (dsa.msc)

Trough PowerShell

The line below returns a array of strings, in this case the distinguished names of the ADGroups.

Get-ADUser Siva -Properties Memberof | %{$_.memberof}

CN=iLO-Admins,CN=Users,DC=MULPURU,DC=LOCAL
CN=SQL-Admins,CN=Users,DC=MULPURU,DC=LOCAL
CN=SCVMM-Admins,CN=Users,DC=MULPURU,DC=LOCAL
CN=WDM-Admins,CN=Users,DC=MULPURU,DC=LOCAL
CN=SCCM-Support,CN=Users,DC=MULPURU,DC=LOCAL
CN=CTXPVS-Admins,CN=Users,DC=MULPURU,DC=LOCAL
CN=XenDesktop-Admins,CN=Users,DC=MULPURU,DC=LOCAL
CN=APPV-Admins,CN=Users,DC=MULPURU,DC=LOCAL

Pipe the string array with for-each loop to Get-ADGroup command-let and select only the names

Get-ADUser Siva -Properties Memberof | %{$_.memberof} | %{get-adgroup $_ | select name}

name
—-
iLO-Admins
SQL-Admins
SCVMM-Admins
WDM-Admins
SCCM-Support
CTXPVS-Admins
XenDesktop-Admins
APPV-Admins

Prerequisite

Import-Module ActiveDirecory

One thought on “Display ADGroups of a User (Memberof)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s