Retrieve M365 Group Owner using PowerShell

Modified on Thu, 03 Nov 2022 at 09:52 AM

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"
}




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article