Gets one or more Active Directory groups.



Example: Get a group by SAM account name

Get-ADGroup -Identity Administrators


Example: Get a group and filter the results

Get-ADGroup -Filter 'GroupCategory -eq "Security" -and GroupScope -ne "DomainLocal"'




Gets the members of an Active Directory group.


Example: Get all Administrators group members

Get-ADGroupMember -Identity Administrators


Example: Get members of a group including the members of child groups

Get-ADGroupMember -Identity "Enterprise Admins" -Recursive


-Recursive

Specifies that the cmdlet get all members in the hierarchy of a group that do not contain child objects.

If the specified group does not have any members, then nothing is returned.



Gets the Active Directory groups that have a specified user, computer, group, or service account.


Example: Get group memberships for the user account (Administrator)

Get-ADPrincipalGroupMembership -Identity Administrator


Example: Get group memberships for the computer account (DC001$)

Get-ADPrincipalGroupMembership -Identity Administrator