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 03, 2024
Did that answer your question?
IrvanR
Nov 08, 2024Brass Contributor
Yes, I have been able to bulk change the prefix of the primary email address group using the script and csv format you provided. Thank you