Manual add Remote Routing Addresses to All Mailboxes

When you’re setting up an Exchange Hybrid environment the Hybrid Configuration Wizard will add the Remote Routing Address to the Default Email Address Policy. Not all organizations make use of an Email Address Policy (EAP) that enables the automatic creation of the primary SMTP (reply) address and additional proxy addresses, like the @tenantname.mail.onmicrosoft.com proxy address, which will be used as Remote Routing Address by Exchange once the mailbox has been migrated to Exchange Online. So, let’s look how to manual add Remote Routing Addresses to All Mailboxes.

Enabling an EAP could potentially alter the primary SMTP address for all mailboxes to which it is applied. If your organization has thousands of mailboxes, that can have devastating consequences. Especially when an organization isn’t consistent about its primary SMTP naming convention. So how do we solve this issue?

This simpel PowerShell script can help you adding a proxy address to all mailboxes once executed from an Exchange Admin Center console.

PowerShell
$mailboxes = Get-Mailbox -ResultSize Unlimited

foreach ($mailbox in $mailboxes) {
$primary = get-mailbox -Identity $mailbox. Identity | select PrimarySMTPAddress 
$alias = $primary.PrimarySmtpAddress.local + '@[name of your tenant].mail.onmicrosoft.com' 
Set-Mailbox $Mailbox.identity -EmailAddresses @{add=$alias} }

But what about the newly created mailboxes after we’ve run this script? One solution is to filter the cmdlet that collects all mailboxes to find all mailboxes that are created in, for example, the last day. Surely now you’ll need to run this script every day to make sure that new mailboxes will get a proxy address added.

PowerShell
$mailboxes = Get-Mailbox -ResultSize Unlimited | ?{ $_.CreationDate -gt $(get-date).adddays(-1)}

Another, much easier, solution is to create an EAP and make use of a recipient filter that specifies the recipients whose email addresses are configured by the policy.

So, there you have it, this is how you manual add Remote Routing Addresses to All Mailboxes. Did you encounter this issue during your migration? And how did you solve this? Let me know in the comments.


Posted

in

,

by

Comments

Leave a Reply