Display or Export the Members of Exchange Distribution Groups

Applies to: Exchange Server 2007

The members of Distribution Groups can be viewed and modified through the Outlook Address Book. However, Outlook doesn’t offer a way to export a list of all the members.

Administrators can run the following Exchange Management Shell commands to display/export the memberlist, sorted by DisplayName.

Single Distribution Group

  • Display Memberlist
    Get-DistributionGroupMember {Name of Group} | Sort -Property DisplayName | Select DisplayName, Alias, Department
  • Export Memberlist to TXT file
    Get-DistributionGroupMember {Name of Group} | Sort -Property DisplayName | Select DisplayName, Alias, Department > C:DGmemberlist.txt
  • Export Memberlist to CSV file
    Get-DistributionGroupMember {Name of Group} | Sort -Property DisplayName | Select DisplayName, Alias, Department | Export-CSV C:DGmemberlist.csv

All Distribution Groups in the Exchange Organization

  • Display Memberlist (create a script file called something like C:scriptsGet-DGmembers.ps1, paste below commands into it, and run the file in the Exchange Management Shell)
    get-distributiongroup | Sort -Property DisplayName | foreach {
    $name = $_.displayname
    $output = ‘Group Name: ‘ + $Name
    write-output $output
    Get-DistributionGroupMember $name | Sort -Property DisplayName | Select DisplayName, Alias, Department
    write-output “” “”
    }
  • Export Memberlist to TXT file (create a script file called something like C:scriptsExport-DGmembers.ps1, paste below commands into it, and run the file in the Exchange Management Shell)
    write-output “” > C:outputDGmembers.txt
    get-distributiongroup | Sort -Property DisplayName | foreach {
    $name = $_.displayname
    $output = ‘Group Name: ‘ + $Name
    write-output $output >> C:outputDGmembers.txt
    Get-DistributionGroupMember $name | Sort -Property DisplayName | Select DisplayName, Alias, Department >> C:outputDGmembers.txt
    write-output “” “” >> C:outputDGmembers.txt
    }
Leave a comment ?

16 Comments.

  1. You are a life saver. I don’t care that this entry was from April 2009, you saved me a ton of work.

  2. Thank you very much.
    I’m a fan of lDIFDE and I used your instructions but swapped $name = $_.displayname for $DN = $_.DistinguishedName, as well as just selected the DistinguishedName for the Members part, and outputted to a .ldf file for easy manipulation in NotePad++ and then replaced the members attribute of the matching groups in the domain that I am migrating our customer to.

  3. Fantastic – needed this and it worked perfectly.
    Thankyou Wil

  4. thanks for the script. can the data be set for one line?

  5. Super nice… Thank you for sharing

  6. Exactly what I was looking for, simple and effective. thank you very much.

  7. hi,
    it is giving me warning message that, by default only the first 1000 items are returned use the result size parameters to specify the number of items. how to sort out.

  8. Thanks, though this old page, it helped me now

  9. Thank you for the script.
    It helped.
    Can you help me modify it to list the email address of the distribution group?
    Thank you again.

  10. Once you add the list on outlook email, just ungroup the list and select all adresses then copy/past !

  11. Thanks for sharing work like magic. 😆

  12. Is there a way to feed in a list of DL names and just output the members for this list instead of all DL’s? I work for a governement made up of lots of different groups, each with their own OU and users and groups.

  13. Worked great. One minor correction added \ in output paths.

    Many thanks

  14. The below script you posted works but returning with 1000 output and not saving to a CSV. Please help me and its urgent .

    write-output “” > C:outputDGmembers.txt
    get-distributiongroup | Sort -Property DisplayName | foreach {
    $name = $_.displayname
    $output = ‘Group Name: ‘ + $Name
    write-output $output >> C:outputDGmembers.txt
    Get-DistributionGroupMember $name | Sort -Property DisplayName | Select DisplayName, Alias, Department >> C:outputDGmembers.txt
    write-output “” “” >> C:outputDGmembers.txt
    }

  15. Hi… I’m working in a new environment and am having an issue with getting a list of members for Dynamic Distribution groups.

    I tries -get-DynamicDistributionGroup but it errors that this cmdlet does not exist. Any help on this? When I google around it seems that this cmdlet should exist.

    Any help is appreciated!

    Thanks in advance…

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>