-->

Saturday, August 22, 2015

Exchange 2010/2013 Bulk Add Members to Distribution Groups From CSV

I just had to add a ton of members (283 of them) to a distribution group in Exchange, so I thought I'd write a quick post on importing a list of users from a CSV into the distro group.

First, create a CSV with a list of users and a heading like "EmailAddress". This heading will be used in the PowerShell command later.

**Note** I tend to use email addresses because they're usually more constant than things like usernames, which can be in different formats depending on how many migrations/acquisitions you go through.

You can use Notepad or Excel to build the CSV, and they'll look like this:

Distribution Group Members CSV

Save your new CSV with a distinctive name like BulkDistroGroupMembers.csv and in location like C:\Temp.

Fire up the Exchange Management Shell (EMS) and cd to the location of your CSV:

cd C:\Temp

Then run:

Import-CSV "BulkDistroGroupMembers.csv" | ForEach {Add-DistributionGroupMember -Identity "Distribution Group Name" -Member $_.EmailAddress}

**Note** Change "Distribution Group Name" to the distro group you are adding members to. $_.EmailAddress will correspond to your heading in the CSV. You can name the heading what you like, just make sure that the -Member value matches the heading.

Now your distribution group will quickly have a ton of members.

5 comments:

  1. It did not work
    I pasted the script
    Import-CSV "addmem1.csv" | ForEach {Add-DistributionGroupMember -Identity "DG New Set" -Member $_.EmailAddresses}

    The result was
    Add-DistributionGroupMember is not recognized as the name of a cmdlet, function, script file, or operable program.

    ReplyDelete
    Replies
    1. Are you running the cmdlet in the Exchange Management Shell or AD PowerShell? It needs to be run in the EMS, unless you add the Exchange snap-in.

      And, is the account you're using a member of the Recipient Management RBAC group?

      Delete