We help IT Professionals succeed at work.

Exchange Online - How to change primary SMTP and add Secondary SMTP using Powershell

For Exchange online, how do I change the primary SMTP for all email accounts including resources, shared mailboxes to "newdomain.com"  and have a secondary domain to be "newdomaingroup.com" in bulk using Powershell?
Watch Question

Systech AdminChief Technology Officer

did you tried with Email Policy to update??
Applications Director
Get-Mailbox -Filter * | select DisplayName,PrimarySmtpAddress | Export-CSV c:\emailaddress.csv -NoTypeInformation

Add new column NewEmailAddress to csv and then import

Import-CSV C:\NewSMTP.csv | foreach {Set-Mailbox $_.DisplayName -WindowsEmailAddress $_.NewEmailAddress}

Explore More ContentExplore courses, solutions, and other research materials related to this topic.