Use PowerShell, or if you don't know how to write such a script, look up examples online - there are plenty such scripts. Here is one of mine: https://www.michev.info/blog/post/4394/report-on-recursive-group-membership-via-exchange-powershell
How to export Distribution List & its nested Distribution Lists' members to CSV file
Hello,
We want to export all members of one large distribution list and its nested distribution lists. How can we do that?
Regards,
Raj
2 answers
Sort by: Most helpful
-
-
Xintao Qiao-MSFT 3,450 Reputation points Microsoft Vendor
2024-10-18T02:32:16.9466667+00:00 Hi, @raj a
As Vasil Michev said, using Power Shell is the fastest way to operate with large distribution lists.
Unfortunately, the current Exchange tag is not focused on providing scripting. I'm going to add Power Shell tag for you.
From my personal point of view, I tried to write the following script for your reference.
function Get-DistributionGroupMembers { param ( [string]$GroupName ) $Group = Get-DistributionGroup -Identity $GroupName $Members = Get-DistributionGroupMember -Identity $GroupName foreach ($Member in $Members) { if ($Member.RecipientType -eq 'MailUniversalDistributionGroup' -or $Member.RecipientType -eq 'MailUniversalSecurityGroup') { Get-DistributionGroupMembers -GroupName $Member.Name } else { $Member | Select-Object Name, PrimarySmtpAddress } } } $GroupName = "test1016@****.com" $Results = Get-DistributionGroupMembers -GroupName $GroupName $Results | Export-Csv -Path "C:\users\DistributionListMembers.csv" -NoTypeInformation
There is a similar case here for your reference. exchange online : Export list of nested distribution group members in entire forest via powershell in csv format - Microsoft Q&A
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".