Quick Tip–Add a member account to all Distribution Groups in your Environment

Today I had the need to add a single user to all the Distribution Groups (around 120) within my Exchange Environment. Thankfully doing this task via Powershell this is a very simple "one liner".

All you need to do is open an Exchange Management Shell Window and Type in the following command:

Get-DistributionGroup | Add-DistributionGroupMember -member Administrator -ErrorAction SilentlyContinue

This command will in essence get every distribution group that you have setup within your environment Get-DistributionGroup and then using the Add-DistributionGroupMember command add the selected user (in my example “Administrator) to each group. I have used the -ErrorAction SilentlyContinue Switch to allow the command to continue, should the account be determined to already be a member of any of the groups.

Just as a point of note – if you are using Exchange 2010 and have configured moderation with RBAC on your Distribution Groups, you should modify the command to look like the following:

Get-DistributionGroup | Add-DistributionGroupMember -member Administrator -BypassSecurityGroupManagerCheck -ErrorAction SilentlyContinue

The added parameter -BypassSecurityGroupManagerCheck allows for admins whom are not specifically owners of the Distribution List to modify the group membership (more about this can be read here: http://technet.microsoft.com/en-us/library/bb124340.aspx)

Sharing is caring!:

Leave a Reply

Your email address will not be published. Required fields are marked *

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