Getting a list of all users in an Active Directory group is a common task for IT administrators — for audits, access reviews, licence management and security checks. This guide covers how to get all members of an AD group using PowerShell, including nested group members, in 2026.
Get All Members of an AD Group
# Get all members of a specific AD group
Get-ADGroupMember -Identity "GroupName" | Select-Object Name, SamAccountName, ObjectClass
# Get members with more detail
Get-ADGroupMember -Identity "GroupName" |
Get-ADUser -Properties DisplayName, EmailAddress, Department, Enabled |
Select-Object DisplayName, SamAccountName, EmailAddress, Department, Enabled |
Format-Table -AutoSize
Get All Members Including Nested Groups
# Get all members recursively - includes members of nested groups
Get-ADGroupMember -Identity "GroupName" -Recursive |
Select-Object Name, SamAccountName, ObjectClass |
Sort-Object Name |
Format-Table -AutoSize
Export Group Members to CSV
# Export all group members to CSV
$groupName = "IT Admins"
$outputPath = "C:ReportsGroupMembers_$(Get-Date -Format 'yyyyMMdd').csv"
Get-ADGroupMember -Identity $groupName -Recursive |
Where-Object {$_.objectClass -eq "user"} |
Get-ADUser -Properties DisplayName, EmailAddress, Department, Title, Manager, Enabled, LastLogonDate |
Select-Object DisplayName, SamAccountName, EmailAddress, Department, Title, Enabled, LastLogonDate |
Export-Csv -Path $outputPath -NoTypeInformation
Write-Host "Exported to $outputPath"
Get All Groups a User Belongs To
# Get all AD groups a specific user is a member of
Get-ADPrincipalGroupMembership -Identity "username" |
Select-Object Name, GroupCategory, GroupScope |
Sort-Object Name |
Format-Table -AutoSize
Count Members in All AD Groups
# Get member count for all AD groups
Get-ADGroup -Filter * -Properties Members |
Select-Object Name, @{N="MemberCount";E={$_.Members.Count}} |
Sort-Object MemberCount -Descending |
Format-Table -AutoSize
Find Empty AD Groups
# Find AD groups with no members
Get-ADGroup -Filter * -Properties Members |
Where-Object {$_.Members.Count -eq 0} |
Select-Object Name, GroupCategory, GroupScope |
Export-Csv -Path "C:\Reports\EmptyGroups.csv" -NoTypeInformation
Frequently Asked Questions
Why does Get-ADGroupMember not return all members?
By default Get-ADGroupMember has a limit of 5000 members. For groups with more than 5000 members use the -Recursive parameter or query the group’s member attribute directly: (Get-ADGroup -Identity ‘GroupName’ -Properties Members).Members
What is the difference between Get-ADGroupMember and Get-ADPrincipalGroupMembership?
Get-ADGroupMember returns the members OF a group. Get-ADPrincipalGroupMembership returns all groups that a user or computer is a MEMBER OF. Use the first to audit group membership, the second to audit a user’s access.
How do I get members of a Distribution Group in Exchange?
Distribution groups are also AD groups, so Get-ADGroupMember works for them. Alternatively in Exchange PowerShell use: Get-DistributionGroupMember -Identity ‘GroupName’ which gives you additional Exchange-specific properties.
Can I run these commands without the Active Directory PowerShell module?
No — these commands require the Active Directory module, which is part of RSAT (Remote Server Administration Tools). Install it via: Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 on Windows 10 or 11.
About The Author
Related
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.

