Add Mailbox Users to Distribution Lists with PowerShell

To add an individual mailbox user to a distribution group in PowerShell that has an owner already assigned, the command will look similar to this…

Add-DistributionGroupMember -Identity "DISTRIBUTION_GROUP_NAME" -Member "USER_ALIAS" -BypassSecurityGroupManagerCheck

 

To add multiple mailbox users to multiple distribution groups, we need to make a CSV file (C:\DistroMembers.csv for this example). The CSV file should contain a row for every distribution group that each mailbox user is being added to because the Add-DistributionGroupMember command only allows one user (member) to be assigned at a time.

Given that, the CSV should look similar this, with Alias and DistributionGroup as the column headers…

Alias,DistributionGroup
JDoe,Human Resources
JDoe,Management
JSmith,IT
JSmith,Executives

 

The command should look similar to this…

Import-Csv "C:\DistroMembers.csv" | ForEach-Object { Add-DistributionGroupMember -Identity $_.DistributionGroup -Member $_.Alias -BypassSecurityGroupManagerCheck }

 

Reference(s):

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s