Exchange Online. Hybrid and non hybrid.

%3CLINGO-SUB%20id%3D%22lingo-sub-312819%22%20slang%3D%22en-US%22%3EExchange%20Online.%20Hybrid%20and%20non%20hybrid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312819%22%20slang%3D%22en-US%22%3E%3CP%3EHey%20Guys%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20set%20the%20PrimarySMTPAddress%20using%20PowerShell%20in%20exchange%20online%20for%20a%20few%20different%20users.%20I%20realize%20that%20when%20connecting%20to%20office%20365%20powershell%20directly%2C%20i%20can%20use%20the%20set-mailbox%20command%20and%20the%20-EmailAddresses%20field.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%20in%20in%20Exchange%20On-Prem%20(DirSync'd%20to%20Office%20365)%2C%20i%20tried%20running%20running%20set-remotemailbox%20-primarysmtpaddress%2C%20the%20command%20ran%20fine%20and%20the%20address%20was%20changed%20but%20only%20for%20the%20on%20premise%20%22Object%22.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20i%20change%20the%20PrimarySMTPAddress%20for%20a%20Sync'd%20user%20and%20have%20that%20address%20show%20up%20in%20their%20Exchange%20Online%20Mailbox%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERobert%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-312819%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313167%22%20slang%3D%22en-US%22%3ERe%3A%20Exchange%20Online.%20Hybrid%20and%20non%20hybrid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313167%22%20slang%3D%22en-US%22%3EGreat!%20There%20was%20powershell%20commands%20as%20well%20in%20my%20link%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313158%22%20slang%3D%22en-US%22%3ERe%3A%20Exchange%20Online.%20Hybrid%20and%20non%20hybrid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313158%22%20slang%3D%22en-US%22%3E%3CP%3EOK%20so%20this%20worked!!%20Set-RemoteMailbox%20-Identity%20%22Dave%20Bedrat%22%20-WindowEmailAddress%20new%40domain.com%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%20Driving%20me%20nuts.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313131%22%20slang%3D%22en-US%22%3ERe%3A%20Exchange%20Online.%20Hybrid%20and%20non%20hybrid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313131%22%20slang%3D%22en-US%22%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F72542%22%20target%3D%22_blank%22%3E%40adam%20deltinger%3C%2FA%3E%26nbsp%3Bwrote%3A%3CBR%20%2F%3EUse%20the%20proxy%20addresses%20attribute!!%20You%20set%20all%20mail%20addresses%20here%20and%20the%20primary%20in%20capital%20SMTP%3A%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20more%20info%20and%20powershell%20cmdlets%20Please%20see%20following%20link%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.tachytelic.net%2F2018%2F08%2Foffice-365-how-to-change-primary-email-address%2Famp%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.tachytelic.net%2F2018%2F08%2Foffice-365-how-to-change-primary-email-address%2Famp%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3Ethanks%20Adam.%26nbsp%3B%20I%20understand%20that%20i%20can%20use%20set-aduser%2C%20aduc%2C%20and%20ECP.%20However%20i%20wanted%20to%20know%20how%20to%20do%20it%20using%20powershell%2C%20set-remotemailbox%20absolutely%20did%20not%20work%2C%20it%20changed%20it%20on%20my%20local%20object%20but%20the%20newly%20added%20address%20did%20not%20sync%20at%20all.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20just%20want%20to%20know%20how%20to%20do%20this%20with%20powershell.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERobert%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-312882%22%20slang%3D%22en-US%22%3ERe%3A%20Exchange%20Online.%20Hybrid%20and%20non%20hybrid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312882%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20have%20to%20wait%20for%20DirSync%20to%20replicate%20the%20changes%20to%20Exchange%20Online%2C%20which%20in%20most%20cases%20should%20take%20less%20than%20one%20hour.%20Now%2C%20if%20you%20absolutely%20must%20change%20the%20address%20directly%20in%20ExO%20for%20any%20reason%2C%20you%20can%20use%20the%20following%20workaround%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESet-Mailbox%20user%20-WindowsEmailAddress%20new%40domain.com%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20cmdlet%20above%20will%20change%20the%20primary%20SMTP%20address%20to%20new%40domain.com%2C%20while%20preserving%20the%20old%20one%20as%20secondary%2C%20regardless%20of%20whether%20the%20user%20is%20synced%20or%20not.%20However%2C%20now%20the%20cloud%20and%20on-premises%20objects%20will%20be%20out%20of%20sync%2C%20and%20this%20change%20can%20potentially%20be%20overwritten%20by%20DirSync%20in%20the%20future.%20So%20this%20is%20more%20of%20a%20workaround%2C%20not%20a%20supported%20scenario.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-312850%22%20slang%3D%22en-US%22%3ERe%3A%20Exchange%20Online.%20Hybrid%20and%20non%20hybrid.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-312850%22%20slang%3D%22en-US%22%3EUse%20the%20proxy%20addresses%20attribute!!%20You%20set%20all%20mail%20addresses%20here%20and%20the%20primary%20in%20capital%20SMTP%3A%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20more%20info%20and%20powershell%20cmdlets%20Please%20see%20following%20link%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.tachytelic.net%2F2018%2F08%2Foffice-365-how-to-change-primary-email-address%2Famp%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.tachytelic.net%2F2018%2F08%2Foffice-365-how-to-change-primary-email-address%2Famp%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
Highlighted
Frequent 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
Highlighted
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/

Highlighted

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.

Highlighted

@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

 

 

Highlighted

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

 

Thanks. Driving me nuts. 

Highlighted
Great! There was powershell commands as well in my link