Get-ADGroupMember
Use Get-ADGroupMember to list the members of an Active Directory group, optionally expanding nested groups.
Documentation: Microsoft Learn — Get-ADGroupMember
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-ADGroupMember [-Identity] <ADGroup> [-Recursive] [-Partition <String>] [-Server <String>] [-Credential <PSCredential>] [<CommonParameters>]- Stage 1Get-ADGroupMember
-Identity -Recursive -Partition -Server -Credential
Try it
Browser simulation · fictional data; no changes to your computer.
Follow the objects
Run the command to inspect each stage.
Examples
Get-ADGroupMember -Identity "Domain Admins"
Show reference output
Sample output · fictional data, shaped like the real thing
Name SamAccountName ---------- -------------- Jane Smith jsmith Alex Jones ajones
Get-ADGroupMember -Identity "Sales-Read"
Show reference output
Sample output · fictional data, shaped like the real thing
Count Name ----- ---- 2 SampleA 1 SampleB
Parameters
Parameter definitions:
-Identity-Recursive-Partition-Server-Credential
Practical use and troubleshooting
Practical scenario: Use Get-ADGroupMember when you need to list the members of an Active Directory group, optionally expanding nested groups. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: A membership query can fail when a referenced account cannot be resolved. Inspect the group and the identity in the error rather than treating a partial list as a complete access inventory. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Get-ADGroup. Get-ADGroup reads group objects and attributes; Get-ADGroupMember reads membership. The group's name and category do not enumerate its members. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Put this command to work
List group membership
Import ActiveDirectory first. Read members of IT-Admins and return Name and SamAccountName.
The sandbox is visible now. Sign in with Google only when you run or check a task; commands and temporary files are discarded when you leave.
Run a command to inspect its result.
Inspect starting data
Supported syntax
Virtual files
Recap
Get-ADGroupMember Use Get-ADGroupMember to list the members of an Active Directory group, optionally expanding nested groups.
Next: Add-ADGroupMember