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

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux