Hybid Exchange – Bulk Email Domain Name Change

Method

Here is the methodology I developed using the on premises Exchange Management Shell (EMS) to update multiple users using a comma delimited input file (.CSV) and Powershell. Rather than run as a single script I’ve broken it down into single commands to be run in sequence so you can review the results of each command in turn before proceeding.

 

Test, Test and more Testing!

Remember that you are responsible for any commands you execute – always carefully test any scripts you acquire from the internet unless you know what you are doing!

Test Methodology: To make things easy on yourself create a test account with the old domain address and follow the steps below using a .CSV file with only the test user account in it. This will verify that the methodology works in your environment. You can check the results of each stage of the change by viewing the properties of the remote mailbox in the Exchange Management Console (EMC). You’ll find the remote mailbox users in the EMC under Recipient Configuration\Mail Contact. If you have lots of users use the Find… link. If the process works for your test user then move onto a .CSV with about 10 or so users in as a second phase test (always remember to keep your users informed!). Remember the more users in your CSV the longer each command will take to run – especially the final MSOL commands to the O365 cloud.

 

Using Excel to Manipulate Your Input Data

First off you should have a list of users – hopefully direct from Active Directory, without spelling errors or duplications! Stick the list into excel in a single column with the column heading “User”.

 

Use the File / Save As option and Save as type: CSV (Comma delimited) (*.csv)

 

Click yes on the annoying “Do you really know what you are doing?” message! 🙂

 

Copy the .csv file to your exchange server (or better still a management workstation with EMC and EMS installed). For this example I’ve copied the file to the c:\tmp folder. Make sure you create a folder to hold the files, never use the root of C:\ !!!

 

At this stage it’s a good point to check the contents of the .CSV file. Open the file with Notepad (not Excel) and it should look like this…

 

On the next page we’ll start working with the EMS.

 

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