This How-To is a quick PowerShell script to first find and dump to CSV all users in your on-premise exchange environment without the tenant.mail.onmicrosoft.com alias that gets applied when you enable Hybrid mode with Exchange Online. I found that even though the domain was listed correctly in the email address policy, some users just did not get this alias applied. So I came up with this script to handle that sweep before you start your remote move migration to Office 365.

3 Steps total

Step 1: Remote into the client environment

Remote into your jump box or Exchange server to run the PowerShell script below in Step 2.

Right-click PowerShell and choose Run As ISE Administrator
Copy and paste the script provided in Step 2 into the Scripts Pane
Create the folder C:\csv
Change the ConnectionURI netbiosonpremiseexchange.domain.local to your FQDN for the Exchange server on-premise
Change both URLs for tenantname.mail.onmicrosoft.com to yours
Hit the Green Play button to run the script

Step 3: Prompts

First Prompt is for your Domain Admin creds
Script will connect to your on-premise Exchange server that you set in the URI, run a Get-Mailbox command filtering for those users without your tenantname.mail.onmicorosoft.com name, and export that to CSV.
Then it will take that CSV, import it, and for each object found, it will run the set mailbox command to set the alias@tenantname.mail.onmicrosoft.com alias.

You can run this script right before you start your remote move migrations to be sure this alias error does not show in your remote move migration batches.