1. Export mailbox info and disable the on-premises mailbox
Step 1 – Export mailbox properties to a text file
Get-Mailbox "Alex.User@example.com" | fl > mailboxinfo.txt
You’ll use the LegacyExchangeDN value from mailboxinfo.txt later.
Step 2 – Disable the on-premises mailbox
Disable-Mailbox "Alex.User@example.com"
Confirm
Are you sure you want to perform this action?
Disabling mailbox "Alex.User@example.com" will remove the Exchange properties from the Active Directory user
object and mark the mailbox in the database for removal. If the mailbox has an archive or remote archive, the archive
will also be marked for removal. In the case of remote archives, this action is permanent. You can't reconnect this
user to the remote archive again.
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): Y
2. Enable the remote mailbox
Enable-RemoteMailbox "Alex.User" -RemoteRoutingAddress "Alex.User@example.mail.onmicrosoft.com"
Name RecipientTypeDetails RemoteRecipientType
---- -------------------- -------------------
Alex User RemoteUserMailbox ProvisionMailbox
3. Grab the LegacyExchangeDN from mailboxinfo.txt
- Open
mailboxinfo.txt. - Find the line for
LegacyExchangeDN. - Copy the full value.
/o=Contoso/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=1234567890ABCDEF1234567890ABCDEF-Alex User
4. Add the x500 address to the remote mailbox
Set-RemoteMailbox -Identity "Alex.User" -EmailAddresses @{add="x500:/o=Contoso/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=1234567890ABCDEF1234567890ABCDEF-Alex User"}
5. Final checks
- Force directory sync so updates reach Microsoft 365.
- Confirm the mailbox now appears healthy in Exchange Online.
- Assign the correct Exchange Online license.