Get-MgGroup

What is Get-MgGroup?

Get-MgGroup is a Microsoft Graph PowerShell cmdlet used to retrieve Microsoft 365 groups in your organization. It can fetch Microsoft 365 groups, security groups, and mail-enabled groups with rich filtering and selection options.


Why Use Get-MgGroup?

This cmdlet enables IT admins to automate a wide range of group-related tasks—such as listing, searching, filtering, and auditing groups—saving time and reducing manual effort. It's especially useful for reporting, compliance checks, and large-scale administrative actions.


How to Use Get-MgGroup?

Syntax:

Get-MgGroup -GroupId <GroupId>

Get-MgGroup can be run standalone or with parameters like -GroupId, -All, -Filter, or -Search. It's ideal for retrieving group metadata, performing tenant-wide group audits, generating reports, and scripting automated workflows across dynamic environments.


Get-MgGroup Examples

  • Get-MgGroup -All
  • List all Microsoft 365 groups in the tenant.

  • Get-MgGroup -GroupId "5b34b8a4-6e77-4d8a-94eb-9b150d938f97"
  • Get a specific group by its unique ID.

  • Get-MgGroup -Filter "DisplayName eq 'Marketing'"
  • Retrieve a group whose display name is exactly "Marketing".

  • Get-MgGroup -All -Property Id, DisplayName, GroupTypes
  • Fetch all groups while selecting only the Id, DisplayName, and GroupTypes.

  • Get-MgGroup -Search "displayName:Project"
  • Search for groups whose display names contain the word "Project".

  • (Get-MgGroup -All).Count
  • Get the total number of groups in the tenant.



Summary

Key Point Details
Cmdlet Name Get-MgGroup
Purpose Retrieve Microsoft 365 groups and their properties
Included In Microsoft.Graph.Groups module
Free to Use? Yes, with Graph PowerShell and appropriate permissions
Access Method PowerShell (Microsoft.Graph module)
Common Use Cases Group audits, filtering by department/team, reporting, compliance tasks
Supports Automation Yes – used in scripts, scheduled jobs, and reporting pipelines


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