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

Steel Contributor

 

 

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

4 Replies

@Marvin Ocowith something like that:

 

 

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

 

@Daniel Niccoli 

It looks like it wants an identity argument passed to it...

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

cmdlet Set-DistributionGroup at command pipeline position 1
Supply values for the following parameters:
Identity:
My view:

How to Execute Bulk Updates of Primary SMTP Address for Distribution Lists

Like any mail-enabled object managed by Exchange Online, distribution list proxy addresses determine if Exchange can deliver messages to an object. Sometimes the proxy addresses aren’t correct or need adjustment, such as in the case when an organization wants to make sure that all distribution lists have primary SMTP addresses from a specific domain. This article explains how to use PowerShell to adjust the primary SMTP address when necessary.

https://office365itpros.com/2023/10/17/distribution-list-proxy-address/