Categories

If you are looking for a way to retrieve a Distribution List Group Owner, you can use the following:


In Powershell:


Use below PowerShell one-liner we can list group owners and their email ID in Microsoft 365.

To get for one group.

Get-DistributionGroup TestGroup@Domain.com | select PrimarySmtpAddress, @{n= "ManagedBy"; e={$_.ManagedBy | foreach {(Get-Mailbox $_).PrimarySMTPAddress}}}

To get for all groups

Get-DistributionGroup | select PrimarySmtpAddress, @{n= "ManagedBy"; e={$_.ManagedBy | foreach {(Get-Mailbox $_).PrimarySMTPAddress}}}
We can also filter groups and get the list. 

In Coreview:

{
   "id": "fb151941-aaa7-4200-bcfa-e19dcf03728e",
   "title": "Get DL Owner",
   "lastModified": "2021-11-11T11:24:39.3090000Z",
   "target": "DistributionGroup",
   "tags": [],
   "vars": [],
   "params": [
      {
         "name": "Name",
         "type": "string",
         "isDefault": true
      }
   ],
   "columns": {
      "Name": ""
   },
   "version": 4,
   "statement": "param ([string]$Name)\r\n\r\n$Manager = Get-DistributionGroup $Name | select PrimarySmtpAddress, @{n= \"ManagedBy\"; e={$_.ManagedBy | foreach {(Get-Mailbox $_).PrimarySMTPAddress}}}\n$DLOwner = $Manager.ManagedBy\n\n$json = @\"\n{\n\"OwnerEmailAddress\": \"$DLOwner\"\n}\n\"@ \nreturn $json"