How to Find All Office 365 Groups using PowerShell?

Requirement: Get Office 365 Groups using PowerShell

How to Get Office 365 Groups in Admin Center?

Microsoft Office 365 Groups provide a simple and efficient way to collaborate with other people in your organization. However, manually locating all the groups in your tenant can be a tedious task. This blog post will show you how to use PowerShell to quickly find all Office 365 groups in your tenant.

You can get Office 365 groups through Microsoft 365 admin center as an admin.

  • Login to the Microsoft 365 Admin Center site: https://admin.microsoft.com
  • Expand “Groups” and Click on “Groups” in the left navigation. 
  • In the “View” drop-down, Select “Office 365”. That list’s all Office 365 groups to the page.
    How to Get Office 365 Groups

Get Office 365 Group Details using PowerShell

Use Get-UnifiedGroup cmdlet to get all Office 365 groups in Office 365.

#Get Credentials to connect
$Credential = Get-Credential
 
#Connect to Exchange Online
Connect-ExchangeOnline -Credential $Credential -ShowBanner:$False
 
#Get all Office 365 Group
Get-UnifiedGroup

#Disconnect Exchange Online
Disconnect-ExchangeOnline -Confirm:$False

This cmdlet retrieves all Office 365 groups.

get office 365 group using powershell

You may query specific properties of the Office 365 group by,

Get-UnifiedGroup | Format-Table Alias, WhenCreated, WhenChanged, SharePointSiteUrl

Similarly, to get office 365 group id using PowerShell, use:

Get-UnifiedGroup -Identity "Marketing" | Select ID

Export Office 365 Groups using PowerShell

Get-UnifiedGroup | Select Guid,DisplayName,Alias, AccessType,ManagedBy,WhenCreated | Export-Csv -Path "C:\Temp\Groups.csv" -NoTypeInformation

This PowerShell generates a CSV file as:

Export Office 365 groups to CSV using powershell

PowerShell to get all Office 365 Groups from Azure AD

We can also get a list of Office 365 groups using Azure AD PowerShell cmdlets.

#Connect to Azure AD
Connect-AzureAD

#Get All Microsoft 365 groups
Get-AzureADMSGroup -Filter "groupTypes/any(c:c eq 'Unified')" -All:$true

To get all owners of Office 365 groups, use: Find All Office 365 Group Owners using PowerShell

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply