Bulk add user to distribution group

Copper Contributor

Bulk add users to Distribution Group


I was ask recently to simplify a task for support staff to bulk add users to a distribution group. So i created the following script to add user from csv.


The script will 'prompt' for 'Distribution Group' name and will add users accordingly.

I have also added the 'WhatIf' option by default.



#Created to simplify daily tasks
#Web: http://thatlazyadmin.com
#Twitter: Shaun.Hardneck
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
$DGroup = Read-Host 'Insert Distribution Group Name'
Import-Csv 'C:\Softlib\Users.csv' |
try {
Add-DistributionGroupMember -Identity $DGroup -Member $_.name -ErrorAction stop -WhatIf
catch [system.exception]
Write-Host "$_.name" -ForegroundColor Red


Hope this helps someone out there in the wild wild net.




4 Replies

@Shaun Hardneck what would be the header in CSV file? Just Name?

This script works for me:


$Dgroup = Read-Host 'Insert Distribution Group Name'
Import-Csv "C:\scripts\AddDistGroupMembers.csv" |
foreach{Add-DistributionGroupMember -Identity $DGroup -Member $_.email}



And the .csv file has a header "email"

@Deleted  Just add the emailaddress in text file and feed to below script, it has status bar, error reporting & some handy features



@Bric_100  That script got removed. Any chance to load here?