Some time ago I had to perform update of one of DLs with all mails from company.
I prepared a simple commands and will share it with you. The csv file is the export of emails I want to add. Imported file has 2 columns – surname and email address (primarySmtpAddress). 1st one column is not obligatory of course.
1 2 3 4 5 6 7 8 |
$userList = import-csv "C:\allMails.csv" -delimiter ';' ForEach ($user in $userList) { Add-DistributionGroupMember -Identity "DL-TEST" -Member $user.PrimarySmtpAddress } |