MSAutomate

Getting Members of Nested Distribution Groups

We all know that getting the members of nested distribution groups in Exchange can be cumbersome. Especially when those nested distribution groups have nested distribution groups and so on. I ran into this issue recently and have thrown together a quick PowerShell function that you can utilize to gather all user mailboxes.

How to Use

  1. Copy the PowerShell function into a PowerShell Window
  2. Run the following command: Get-DistributionGroupMembersRecursive -PrimarySmtpAddress dl-test@domain.com

In this demo, I queried my main Distribution Group, dl-parent. This is how the distribution groups are setup:

  • DL-Parent
    • Jordan
    • DL-Child
      • DL-SubChild
        • Katy

You can pipe this command to Export-CSV if you wish to get all of the mailbox properties of the members.

Github Link: https://github.com/jordanbardwell/Scripts/blob/main/Get-DistributionGroupMemberRecurisve.ps1

Jordan Bardwell

Add comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed