Forum Discussion
IrvanR
Oct 12, 2024Brass Contributor
change the primary address (prefix) distribution list group
change the prefix on the primary address distribution list group how to bulk change primary smtp address distribution list group (before @ / prefix) with powershell? can use csv file? if possi...
- Oct 30, 2024
IrvanR You could use something like:
#Install module and connect Install-Module ExchangeOnlineManagement Connect-ExchangeOnline #Loop through csv file and change primary smtp foreach ($row in Import-Csv -Path C:\data\dl.csv -Delimiter ';') { try { Set-DistributionGroup -Identity $row.GroupName -PrimarySmtpAddress $row.Email -ErrorAction Stop Write-Host ("Updated {0}" -f $row.GroupName) } catch { Write-Warning ("Error updating {0}" -f $row.GroupName) } }CSV looks like:
GroupName;Email
Testdl1;email address removed for privacy reasons
Testdl2;email address removed for privacy reasons
Nov 08, 2024
No problem, glad it worked for you 😊
- IrvanRDec 04, 2024Brass Contributor
I have another question Harm_Veenstra, Can this script also be used to bulk update SMTP address DL group in Exchange Server 2019?
- Dec 04, 2024
Yes, you can run it on a Exchange server, too. Just remove the first four lines