Add member to distribution list from file

Add-DistributionGroupMember –identity “Senior Managers” –member “Contoso\Steve.Smith”

I want to add members to a group but from a file that contains emails addresses of users in my domain.  How can I do that?
Who is Participating?
timgreen7077Connect With a Mentor Exchange EngineerCommented:
1. You can add the user's email address or username to a .csv file, and the column header should be labeled 'Name',
2. Name the csv file to name.csv
3. In the Exchange management shell paste the following (be sure to change the directory to the directory where the .csv file is locate)

Import-CSV names.csv | ForEach {Add-DistributionGroupMember -Identity "Name of DL" -Member $_.Name}

This will allow bulk import from a .csv file.
WTHTechAuthor Commented:
This worked like a charm.  Thanks very much!
timgreen7077Exchange EngineerCommented:
timgreen7077Exchange EngineerCommented:
Please accept my answer so that the ticket can be closed.
WTHTechAuthor Commented:
This worked perfectly
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.