Playing with Remote Mailboxes


Remote Mailboxes are a way to create a mailbox directly in Exchange Online without having to create it first on-premise. The mailbox attributes are DirSync’ed to Exchange Online rather than having to do a remote mailbox move. Recently I was asked to create a number of remote mailboxes for users that were already present in Active Directory, however these mailboxes were needed before hybrid mail flow was fully configured. The requirements were that in the future they needed to route mail as normal in the hybrid environment and the email address policy could not be used. This was quite a custom-made requirement but it enabled me to understand the limits of the GUI and the PowerShell cmdlets.

If you want to create the Active Directory user as well as the mailbox you will use the EMC, or the New-RemoteMailbox cmdlet. If the user is already present you would have to use the Enable-RemoteMailbox cmdlet as there is no ‘Enable-RemoteMailbox’ function in the EMC.

As advised on Technet you would just use the cmdlet without any parameters and rely on email address policy and the hybrid configuration to manage the addresses.

Enable-RemoteMailbox ‘user’

However as is well documented this does not work for Exchange 2010/2013 hybrid and you get the following error:

 

You should always add the remote routing address parameter.

Enable-RemoteMailbox user@domain.com -RemoteRoutingAddress alias@tenant.mail.onmicrosoft.com

This creates the Remote Mailbox but when it is DirSync’ed to Exchange Online the online mailbox does not have a proxy address in the format alias@tenant.mail.onmicrosoft.com. Therefore when hybrid mail routing is configured the remote mailbox will forward the mail to Exchange Online but the mailbox will not be able to receive it.

Convert bulk users to Remote Mailbox in Office 365 Hybrid.

 Enable Remote Mailbox Single user

Get-user usersname | where-object{$_.RecipientType -eq “User”}  | foreach {Enable-RemoteMailbox -identity $_.userprincipalname -RemoteRoutingAddress ($_.samaccountname+’@tenantname.mail.onmicrosoft.com’)}

Enable Remote Mailboxes in bulk users located particular OU

Get-user -organizationalUnit “Bangalore” | where-object{$_.RecipientType -eq “User”}  | foreach {Enable-RemoteMailbox -identity $_.userprincipalname -RemoteRoutingAddress ($_.samaccountname+’@tenantname.mail.onmicrosoft.com’)}

Modify Remote Mailboxes in bulk users located particular OU

Get-user -organizationalUnit “Bangalore” | foreach {Set-RemoteMailbox -identity $_.userprincipalname -RemoteRoutingAddress ($_.samaccountname+’@tenantname.mail.onmicrosoft.com’)}

I have found for adding the addresses to the Remote Mailbox and I can credit http://www.mikepfeiffer.net/2011/12/how-to-add-exchange-proxy-addresses-from-a-csv-file-with-powershell/ for that.

Comments (0)

Skip to main content