Exchange Online. Hybrid and non hybrid.

Iron Contributor

Hey Guys, 

 

I am trying to set the PrimarySMTPAddress using PowerShell in exchange online for a few different users. I realize that when connecting to office 365 powershell directly, i can use the set-mailbox command and the -EmailAddresses field. 

 

However in in Exchange On-Prem (DirSync'd to Office 365), i tried running running set-remotemailbox -primarysmtpaddress, the command ran fine and the address was changed but only for the on premise "Object". 

 

How do i change the PrimarySMTPAddress for a Sync'd user and have that address show up in their Exchange Online Mailbox? 

 

Thanks, 

 

Robert

5 Replies
Use the proxy addresses attribute!! You set all mail addresses here and the primary in capital SMTP:

For more info and powershell cmdlets Please see following link:
https://www.tachytelic.net/2018/08/office-365-how-to-change-primary-email-address/amp/

You have to wait for DirSync to replicate the changes to Exchange Online, which in most cases should take less than one hour. Now, if you absolutely must change the address directly in ExO for any reason, you can use the following workaround:

 

Set-Mailbox user -WindowsEmailAddress new@domain.com

 

The cmdlet above will change the primary SMTP address to new@domain.com, while preserving the old one as secondary, regardless of whether the user is synced or not. However, now the cloud and on-premises objects will be out of sync, and this change can potentially be overwritten by DirSync in the future. So this is more of a workaround, not a supported scenario.


@adam deltinger wrote:
Use the proxy addresses attribute!! You set all mail addresses here and the primary in capital SMTP:

For more info and powershell cmdlets Please see following link:
https://www.tachytelic.net/2018/08/office-365-how-to-change-primary-email-address/amp/


thanks Adam.  I understand that i can use set-aduser, aduc, and ECP. However i wanted to know how to do it using powershell, set-remotemailbox absolutely did not work, it changed it on my local object but the newly added address did not sync at all. 

 

I just want to know how to do this with powershell. 

 

Thanks, 

 

Robert

 

 

OK so this worked!! Set-RemoteMailbox -Identity "Dave Bedrat" -WindowEmailAddress new@domain.com

 

Thanks. Driving me nuts. 

Great! There was powershell commands as well in my link