🔧 New: User Management Graph PowerShell Toolkit

Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.

🚀 Launch Toolkit

6 Useful Reports with Get-MgGroup in PowerShell

Managing 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.


Prerequisites

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"

  1. Get All Microsoft 365 Groups
  2. 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.

  3. Get Only Microsoft 365 Groups (Excluding Security and Distribution Lists)
  4. 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.

  5. Report: Public vs Private Microsoft 365 Groups
  6. 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
  7. Count All Groups by Type
  8. 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.

  9. Get Groups Created in the Last 30 Days
  10. 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.

  11. Export All Groups to CSV
  12. 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.


Common Errors & Solutions

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

Conclusion

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