Hi There,

This script will help you to add members to a Distribution Lists (DL) from a CSV file

You just need a csv file with two columns: distribution list name (dlistname) and member (members)

You can also combine this script with another one to add members to DL (Distribution Lists) as well.

Testing the csv file:

Import-Csv .\create-dl.csv 

You should see the following

 

PowerShell code

###########################################################################################     
# Author Thiago Beier thiago.beier@gmail.com     
# Version: 1.0 - 2020-FEB-28    
# Adding user to a DL (Distribution List on Office 365) from CSV file 
# Toronto,CANADA     
# Email: thiago.beier@gmail.com   
# https://www.linkedin.com/in/tbeier/   
# https://thigobeier.wordpress.com 
###########################################################################################  
 
# 
Import-Csv .\add-members-to-dl01.csv | foreach {  
 
write-host "Adding user" $_.members "to" $_.dlistname "DL" -ForegroundColor Yellow 
 
Add-DistributionGroupMember -Identity $_.dlistname -Member $_.members  
 
} 
Download the csv file.

Download the file from Technet Gallery.

Follow Me
TwitterLinkedInFacebookRSS