Get-MgGroupMemberCount

What is Get-MgGroupMemberCount?

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.


Why Use Get-MgGroupMemberCount?

This cmdlet is ideal for reporting and automation. Administrators often use it to:

  • Monitor the membership size of Microsoft 365 groups.
  • Identify oversized or underused groups.
  • Automate group governance and reporting workflows.
  • Integrate membership metrics into scripts for security and compliance checks.

When managing large tenants, this command helps streamline the process of auditing membership distribution across multiple groups.


Prerequisites

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"

How to Use Get-MgGroupMemberCount?

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

Get-MgGroupMemberCount Examples

Example 1: Retrieve the Total Member Count for a Specific Group

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.


Summary

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