Export DL members

Roger Roger 4,956 Reputation points
2020-10-22T19:00:33.267+00:00

Hi All

I have a distribution list lets say dl1@Company portal .com and it has many nested DL's and also many office365 unified groups. I want to export all the members of this DL dl@Company portal .com which includeds nested DLs members and office365 groups members. is there any script to do this, please guide me.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,741 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,210 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,369 questions
{count} votes

Accepted answer
  1. Echo Du_MSFT 17,116 Reputation points
    2020-10-23T03:24:14.467+00:00

    @Roger Roger ,

    You could execute the following script:

    The first script: List the specific Distribution Group Members.

    #Connect to Exchange Online Remote PowerShell.  
    Import-Module ExchangeOnlineManagement  
    Connect-ExchangeOnline -UserPrincipalName "user@test.com" -ShowProgress $true  
    #List all the Microsoft 365 groups in Microsoft 365.  
    Get-UnifiedGroup -ResultSize Unlimited  
    #list all members of a selected single Microsoft 365 group   
    Get-UnifiedGroupLinks –Identity test –LinkType Members –ResultSize Unlimited  
    

    The second script: Get all the information related to every Microsoft 365 Group member, and export to CSV file.

    #Connect to Exchange Online Remote PowerShell.  
    Import-Module ExchangeOnlineManagement  
    Connect-ExchangeOnline -UserPrincipalName "user@test.com" -ShowProgress $true  
      
    #--------------------------#  
    $Groups = Get-UnifiedGroup -ResultSize Unlimited  
    $Groups | ForEach-Object {  
    $group = $_  
    Get-UnifiedGroupLinks -Identity $group.Name -LinkType Members -ResultSize Unlimited | ForEach-Object {  
    New-Object -TypeName PSObject -Property @{  
    Group = $group.DisplayName  
    Member = $_.Name  
    EmailAddress = $_.PrimarySMTPAddress  
    RecipientType= $_.RecipientType  
    }}}} | Export-CSV "C:\\Office365GroupMembers.csv"   
    

    Thanks,
    Echo Du

    ================

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. udara peiris 676 Reputation points
    2020-10-23T00:43:20.637+00:00

    You can use following script.

    https://gallery.technet.microsoft.com/Export-Nested-DL-Members-e9ef3427

    (Don't forget to Accept as answer if this is helpful)

    0 comments No comments