Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

Morning all,

 

I've been tasked with clearing out all of the unnecessary distribution groups in our Exchange which we believe are no longer used.

 

However, the powers that be want a distribution group set up to include all of the email addresses from the deleted groups.

 

I've got a CSV of all the email addresses but need help in getting this over to exchange.

 

Does anyone have a nice powershell script to help?

 

Thanks in advance

Sam

Posted

Assuming that you already have a blank distribution group set up and a csv something like this

 

address,name

[email protected],Joe Bloggs

[email protected], John Smith

 

Something like this should work

 

$emails = Import-CSV C:\emailaddresses.csv
foreach($email in $emails){
$newemail = $email.address
Set-Distributiongroup  -emailaddresses @{Add=$newemail}
}

 

This has not been tested but should at least set you on the right path.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...