Get-MgGroupMemberOfAsGroup is a Microsoft Graph PowerShell cmdlet used to retrieve groups that a specific group is a member of.
In simple terms, it helps you identify nested group memberships where one group is part of another group.
Try the M365Corner Microsoft 365 Reporting Tool â your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Group.Read.All"
| Permission Type | Permissions |
|---|---|
| Delegated | Group.Read.All |
| Application | Group.Read.All |
Ensure admin consent is granted for application permissions.
Syntax
Get-MgGroupMemberOfAsGroup [-GroupId <String>]
Get-MgGroupMemberOfAsGroup
Get-MgGroupMemberOfAsGroup -GroupId efba43ca-ff99-4f70-b2c5-a97e9dbb75d2
Retrieves all groups that the specified group is a member of (nested group memberships).
Get-MgGroupMemberOfAsGroup -GroupId efba43ca-ff99-4f70-b2c5-a97e9dbb75d2 | Select DisplayName,Id
Get-MgGroupMemberOfAsGroup | Export-CSV "D:/groups_group_is_direct_member_of.csv"
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.
© Created and Maintained by LEARNIT WELL SOLUTIONS. All Rights Reserved.