Gets one or more Active Directory groups.
Example 1: Get a group by SAM account name
Get-ADGroup -Identity Administrators
Example 2: 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 1: Get all Administrators group members
Get-ADGroupMember -Identity Administrators
Example 2: 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 1: Get group memberships for the user account (Administrator)
Get-ADPrincipalGroupMembership -Identity Administrator
Example 2: Get group memberships for the computer account (DC001$)
Get-ADPrincipalGroupMembership -Identity Administrator