How To: Get AD DS group membership for specific user (with filtering by part of group name)

In order to get AD DS group membership for specific user (with filtering by part of group name) you may use PowerShell (don’t forget import Active Directory module by issuing import-module activedirectory before running below’s example):

\n\n

Get-ADPrincipalGroupMembership USERNAME | select name | where-object {$_.name -like “*PART_OF_GROUP_NAME*”}

Substitute USERNAME and PART_OF_GROUP_NAME with appropriate values. If you issue just Get-ADPrincipalGroupMembership USERNAME you will get list of all groups in which specified user included (could be long list in large environments).

Similarly you may use Get-ADGroupMember GROUPNAME to get a list of all members for specified group or if you add condition as follows:

\n\n

Get-ADGroupMember GROUPNAME  | select name | where-object {$_.name -like “*PART_OF_USER_NAME*”}

You will get this user(s) if any included in this group.

Of course you may use old-fashioned net user /domain USERNAME for the same purpose but it tends to truncate long groupnames and output formatting / manipulations possibilities by far less flexible.

Please follow and like us:

Leave a Reply

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