Get-GroupMemberReport
PowerShell script to audit Distribution Lists and Microsoft 365 Groups membership using Microsoft Graph API. Returns transitive (recursive) member counts - including all nested group members.
Why?
Get-DistributionGroupMemberonly returns direct members, not nested- Exchange Online cmdlets have pagination timeouts on large tenants
- Graph API’s
Get-MgGroupTransitiveMemberCountsolves both problems
Requirements
- PowerShell 5.1+ or PowerShell 7+
- Microsoft Graph PowerShell SDK
- Permissions:
Group.Read.All,Directory.Read.All
Usage
| |
Output
CSV file with columns:
| Column | Description |
|---|---|
| PrimarySmtpAddress | Group email address |
| DisplayName | Group display name |
| GroupType | DL or M365 |
| Members | Total recursive member count |
| Empty | yes if 0 members |
| Size_1_10 | yes if 1-10 members |
| Size_11_100 | yes if 11-100 members |
| … | etc. |
Size buckets make it easy to filter and analyze DL distribution in Excel.
How it works
- Fetches mail-enabled groups via Graph API
- Filters by
groupTypesproperty ([]= DL,["Unified"]= M365) - Calls
Get-MgGroupTransitiveMemberCountfor each group - Exports results with size category flags
Get the script
Full source code with usage examples: GitHub