Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitManaging Microsoft 365 groups efficiently is essential for keeping your tenant organized and secure. With Microsoft Graph PowerShell, you can use the Get-MgGroup cmdlet to generate valuable insights and reports — all from your PowerShell console.
In this article, we’ll explore 6 practical and easy-to-understand examples of using Get-MgGroup to generate reports that every administrator will find useful.
Before running the scripts, ensure you’ve installed and connected to Microsoft Graph PowerShell:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Group.Read.All"
This is the most basic report, listing all groups in your tenant:
Get-MgGroup -All | Select-Object Id, DisplayName, GroupTypes, Visibility
Tip: The -All switch ensures all groups are retrieved across multiple pages.
Filter out unwanted group types to focus only on Microsoft 365 (Unified) groups.
Get-MgGroup -All |
Where-Object { $_.GroupTypes -contains "Unified" } |
Select-Object DisplayName, Mail, Visibility
This helps administrators distinguish collaboration-enabled groups from traditional security groups.
Knowing which groups are public vs private helps manage information exposure.
Get-MgGroup -All |
Where-Object { $_.GroupTypes -contains "Unified" } |
Group-Object Visibility |
Select-Object Name, Count
Get a quick overview of your tenant’s group types (Unified, Security, etc.):
Get-MgGroup -All |
Group-Object {
if ($_.GroupTypes -contains "Unified") {"Microsoft 365 Group"}
elseif ($_.SecurityEnabled) {"Security Group"}
else {"Distribution Group"}
} |
Select-Object Name, Count
A clean summary report of your group composition.
Track newly created groups for auditing or monitoring activity.
$StartDate = (Get-Date).AddDays(-30)
Get-MgGroup -All |
Where-Object { [datetime]$_.CreatedDateTime -ge $StartDate } |
Select-Object DisplayName, CreatedDateTime
This is helpful for identifying recent team or department setups.
Once you’ve customized your group selection, export it for reporting:
Get-MgGroup -All |
Select-Object DisplayName, Mail, Visibility, CreatedDateTime |
Export-Csv -Path "C:\Reports\M365Groups.csv" -NoTypeInformation
💡 Tip: Use Export-Csv to share reports with colleagues or maintain weekly records.
| Error | Cause | Solution |
|---|---|---|
| Insufficient privileges to complete the operation | Missing Graph API permissions | Reconnect using Connect-MgGraph -Scopes "Group.Read.All" |
| Get-MgGroup : The term is not recognized | Module not installed | Run Install-Module Microsoft.Graph -Scope CurrentUser |
The Get-MgGroup cmdlet is a powerful tool that helps administrators generate actionable insights about their Microsoft 365 environment. Whether you’re cleaning up groups, auditing access, or tracking growth — these PowerShell reports will save you time and give you clarity.
Start with these examples, tweak the filters for your needs, and soon you’ll have a set of custom reports tailored to your organization.
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