Bulk add members to a distribution list

Hi to all.

I need to bulk add member of my organization to a new distribution list.

I have been using PowerShell commands but can't get it to work.

First I created a CSV file like this

DL,Email

mydl,*** Email address is removed for privacy ***

mydl,*** Email address is removed for privacy ***

mydl,*** Email address is removed for privacy ***

then after connecting with PowerShell I use the command:

Import-Csv C:\AddToDList.csv|foreach {Add-DistributionGroupMember -Identity $_.DL -Member $_.Email}

The result is an error for each line.

  Can't find objet "*** Email address is removed for privacy ***" ....

Any help is appreciated.

 

Question Info


Last updated June 14, 2019 Views 22,360 Applies to:
Answer
Answer

hi jcrc,

i’d like to confirm whether you are using the office 365 for enterprise plans.
generally, we follow the steps below to export the distribution group member into a csv file:
1. login to office 365 portal.
2. click admin > exchange to access the exchange admin center.
3. navigate to recipients > groups.
4. select the group you want to export members from, click the little dots which means more and click export data to a csv file.
5. choose the column you need, and then click export. the csv file would look like below:

then we will get the file downloaded to your local drive.
and for importing the csv file to create a new dg, we need to use a powershell command as below:
import-csv <path>| foreach {add-distributiongroupmember -identity <distribution group name> -member $_.alias}

please note that we need  to connect to exchange online using remote powershell before running the cmdlet above.

if the issue still exists after you following the steps above, i’d like to collect the information below:
1. a screenshot of the csv file’s format which looks like the screenshot shows below:

2. a screenshot of the entire error message.
to upload a picture, please click use rich formatting under the reply box and then click the insert/edit media icon.

regards,
poppy

39 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.