The Get-MgGroupMemberCount cmdlet retrieves the total number of members in a specific Microsoft 365 group. It’s part of the Microsoft Graph PowerShell module and provides administrators with an easy way to audit group membership size without needing to retrieve full member details.
This cmdlet is ideal for reporting and automation. Administrators often use it to:
When managing large tenants, this command helps streamline the process of auditing membership distribution across multiple groups.
Before running this cmdlet, install the Microsoft Graph module and connect with the required permissions:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Group.Read.All"
Use the -GroupId parameter to specify the Microsoft 365 group you want to count members for. Include the -ConsistencyLevel Eventual parameter to ensure accurate results across large datasets.
Get-MgGroupMemberCount -GroupId <String> -ConsistencyLevel Eventual
This command retrieves the total number of members in the specified group.
Get-MgGroupMemberCount -GroupId "12345-abcd-6789-efgh" -ConsistencyLevel Eventual
This example is useful for quick reporting or verifying that group membership aligns with expected limits.
| Key Point | Details |
|---|---|
| Cmdlet Name | Get-MgGroupMemberCount |
| Purpose | Retrieves the total number of members in a Microsoft 365 group |
| Required Scope | Group.Read.All |
| Primary Parameter | GroupId, ConsistencyLevel |
| Automation Benefit | Helps monitor and report group membership efficiently |
| Use Case | Useful for group audits, reporting, and governance automation |
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex