Retrieve distribution list group owner

  • Last update on September 26th, 2024

Custom actions are not available in the Essentials solution.

 

If you need to retrieve a distribution list group owner, you can use the following script:

In PowerShell:

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 a CoreView custom action:

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