Hybid Exchange – Bulk Email Domain Name Change

I recently had to amend a large number of users’ primary SMTP address to a new email domain in a hybrid exchange environment. Here’s a useful bulk methodology I developed using a CSV input file with the Exchange Management Shell.

A ‘hybrid’ Exchange environment consists of on premises Exchange servers linked to the Office 365 cloud for storing user mailboxes. The main advantage of such a setup is for an improved administration experience with the O365 mailboxes by using the on premises Exchange Management Console (EMC) and Exchange Management Shell (EMS). You may also find yourself in a hybrid situation during a migration to O365.

Note: This article assumes that the new email domain has already been added to O365 and that mail flow has been set up and tested with a test user account.

For the examples below the users already have an email address in the @bobbitco.com domain and are moving their primary SMTP address to @bobbit.co.

If you’ve done this before and just want the commands go here.

 

WARNING about changing the users User Principal Name UPN

In the following examples we’ll also be changing the users UPN domain to match the new primary SMTP address. This can be considered best practice the following situations; it can prevent replication issues with O365, it can help users because they won’t have to remember multiple user identities and it will keep all users’ UPNs consistent with new users added after the change.

Changing the users UPN will most likely break any application that uses the UPN for single sign on. Likely culprits are Sharepoint, Email access from mobile devices and any other app that uses the user.name@domain.com style username. This is a good reason to perform any change like this with a small batch of test users first to help identify any application issues. You can then make your other users aware of any issues and mitigating steps that can be taken. Most likely they will need to change their username to the new user.name@newdomain.com or create a new profile, depending on the app.

Some apps, like Outlook, work fine until the user changes their windows password. After the password change Outlook prompts for the new password but defaults the username field to the users old UPN so login fails. Users need to be aware they need to change the login to their new UPN. This problem can be avoided by creating a new Outlook profile for the user after their UPN has been changed.

I’ve also seen issues with the change temporarily stopping users out of office  messages being sent.

 

NOTE about Outlook profiles

In full Outlook (as opposed to webmail) the users profile name (above the Inbox) will remain showing the old email address. This is purely cosmetic. The only way to change this is to create a new outlook profile for the user.

 

On the next page we’ll begin the methodology.

 

2 thoughts on “Hybid Exchange – Bulk Email Domain Name Change

  1. Nice work Bobb. Two lines of your code seem to be identical though.
    “Add additional SMTP address” and “Set Primary SMTP address and disable email address policy”.

Leave a Reply to BobbCancel reply