Bulk add members to Distribution List (DL)

$UserCredential = Get-Credential
Get-DistributionGroupMember -Identity “GROUP_NAME@rajanmaharjan.com” | ft alias #to get current list members
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-pssession $Session
$import= import-csv -Path ‘<PATH_TO_CSV_FILE>member-to-add-in-dl.csv’ #location of CSV file
$import | ForEach-Object {
Add-DistributionGroupMember -Identity “GROUP_NAME@rajanmaharjan.com” -Member $_.identity
Write-host $_.identity ‘added to distribution list’
}

Leave a Reply

Your email address will not be published. Required fields are marked *