How do we bulk change Distribution List Primary SMTP from contoso.onmicrosoft.com to contoso.com

Super Contributor

 

 

How do we bulk change 100 Distribution List Primary SMTP from contoso.onmicrosoft.com to contoso.com via powershell?

1 Reply

@Marvin Ocowith something like that:

 

 

Get-DistributionGroup | ? { $_.PrimarySmtpAddress -like "*@contoso.onmicrosoft.com"} | % { Set-DistributionGroup -PrimarySmtpAddress "$($_.PrimarySmtpAddress.Split('@')[0])@contoso.com" -WhatIf }