Ο365 : Add Members In Distribution List Using PowerShell and CSV list File
The steps below show how we can add members in distribution list by using a PowerShell script and a CSV file.
Step 1. Create the CSV File
On the first step we need to create a csv file with the column "Name”
|
Step 2. Run the PowerShell script
The second step is to run the below PowerShell script.
Note: Change the file path first and the alias of distribution list |
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $truE
Import-CSV C:\csv\newmembers.csv | ForEach {Add-DistributionGroupMember -Identity ALIASOFDISTRIBUTIONLIST Member $_.Name}
Write-Host "DONE RUNNING SCRIPT, check for errors"
Read-Host -Prompt "Press Enter to exit"