Office 365 Distribution List Question

Hey Mitch! Do you know if we can add a couple hundred users to a distribution list instead of adding them one by one?

One of my help desk techs was asked to create several distribution lists with several hundred users, and they do not want to have to scroll through the user list to click each user one by one.  Of course there is a solution… PowerShell!  It is pretty easy to do…

Firstly, you need to create a .csv file.  Let’s call it DGroups.csv.  Create the following headers: Alias,DistributionGroup.  It should look like this:

Alias,DistributionGroup
Mitch.Garvis,O365-Admins
Fred.Kippels,O365-Admins
Fred.Kippels,HelpDesk-Managers
John.Frinks,HelpDesk-Managers
John.Frinks,Softball-Players
Mitch.Garvis,Softball-Players

Once you have that, open a PowerShell console, and connect to your Office 365 instance.  Make sure you have the credentials to add users to the groups listed in the file.  Now, run the following cmdlet:

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

That should be it… You should have your users added to the group.  Have fun!

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s