Find All Office 365 Group Owners using PowerShell

Requirement: Get Office 365 Group Owners

How to Get Office 365 Group Owners?

If you need to get a list of Office 365 Group owners in your organization, this guide is for you! This blog post will show you how to use PowerShell to find all group owners in Office 365. Let’s get started!

To get Office 365 group owners from Microsoft 365 admin center, do the following:

  • Log in to the Microsoft 365 Admin Center site:
  • Expand Groups and Click on the Groups link in the left navigation. 
  • The group’s page lists all groups in your Office 365 tenant. Pick the desired group to list the owners of the group.
  • This opens the group’s details page, which lists group Owners
    get office 365 group owners using powershell

Get Office 365 Group Owners using PowerShell:

The script connects to Exchange Online and gets group owners of a given Office 365 group “[email protected]”.

#Connect to Exchange Online
Connect-ExchangeOnline -Credential (Get-Credential) -ShowBanner:$False

#Get Owners of a Office 365 Group
Get-UnifiedGroup -Identity "[email protected]" | Get-UnifiedGroupLinks -LinkType Owner | Select DisplayName, PrimarySmtpAddress

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

Find All Office 365 Group Owners using PowerShell:

To get owners of all Office 365 groups and export to CSV, use:

#Connect to Exchange Online
Connect-ExchangeOnline -ShowBanner:$False

#Get All Office 365 Groups
$GroupData = @()
$Groups = Get-UnifiedGroup -ResultSize Unlimited -SortBy Name

#Loop through each Group
$Groups | Foreach-Object {
    #Get Group Owners
    $GroupOwners = Get-UnifiedGroupLinks -LinkType Owners -Identity $_.Id | Select DisplayName, PrimarySmtpAddress
    $GroupData += New-Object -TypeName PSObject -Property @{
            GroupName = $_.Alias
            GroupEmail = $_.PrimarySmtpAddress 
            OwnerName = $GroupOwners.DisplayName -join "; "
            OwnerIDs = $GroupOwners.PrimarySmtpAddress -join "; "
#Get Groups Data
$GroupData | Export-Csv "C:\Temp\GroupOwners.csv" -NoTypeInformation

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

Find Owners of an Office 365 Group using Azure AD PowerShell:

Make sure you have the “Azure AD” PowerShell Module installed before running this script!

#Connect to AzureAD
Connect-AzureAD -Credential (Get-Credential) | Out-Null

#Get Group Owners
Get-AzureADGroupOwner -ObjectId (Get-AzureADGroup -SearchString "Purchase").ObjectId

PowerShell to Generate Group Owners Report from Azure AD

#Get Credentials to connect
$Cred = Get-Credential
#Connect to AzureAD
Connect-AzureAD -Credential $Cred | Out-Null
$GroupData = @()

#Get all Office 365 Groups
Get-AzureADMSGroup -Filter "groupTypes/any(c:c eq 'Unified')" -All:$true | ForEach-object {
    $GroupName = $_.DisplayName
    #Get Owners
    $GroupOwners = Get-AzureADGroupOwner -ObjectId $_.ID | Select UserPrincipalName, DisplayName 

        $GroupData += New-Object PSObject -Property ([Ordered]@{ 
        GroupName = $GroupName
        OwnerID = $GroupOwners.UserPrincipalName -join "; "
        OwnerName = $GroupOwners.DisplayName -join "; "

#Export Group Owners data to CSV
$GroupData | Export-Csv "C:\Temp\GroupOwners.csv" -NoTypeInformation

Script Output:

Office 365 Group Owners report

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published.