Retrieve M365 group owner using PowerShell

  • Last update on January 25th, 2024

Table of Contents

If you are looking for a way to obtain the owner of an M365 group, you can use the following:

In PowerShell:

#Connect to Exchange Online
Connect-ExchangeOnline -Credential (Get-Credential) -ShowBanner:$False
#Get Owners of a Office 365 Group
Get-UnifiedGroup -Identity "Purchase@Crescent.com" | Get-UnifiedGroupLinks -LinkType Owner | Select DisplayName, PrimarySmtpAddress
#Disconnect Exchange Online
Disconnect-ExchangeOnline -Confirm:$False

In Coreview:

{
 "id": "68f88c15-937c-4129-98b2-4ff3285e4955",
 "title": "Get M365 group Owner",
 "lastModified": "2021-11-11T12:17:41.1850000Z",
 "target": "O365Group",
 "tags": [],
 "vars": [],
 "params": [
 {
 "name": "Name",
 "type": "string",
 "isDefault": true
 }
 ],
 "columns": {
 "Name": ""
 },
 "version": 5,
 "statement": "param ([string]$Name)\r\n\r\n$Manager = Get-UnifiedGroup $Name | select PrimarySmtpAddress, @{n= \"ManagedBy\"; e={$_.ManagedBy | foreach {(Get-Mailbox $_).PrimarySMTPAddress}}}\n$M365GroupOwner = $Manager.ManagedBy\n\n$json = @\"\n{\n\"OwnerEmailAddress\": \"$M365GroupOwner\"\n}\n\"@ \nreturn $json"
}