Exporting Active Directory users primary email address to Excel and importing additional proxyAddress

Back when I was still working on a lot of Exchange on-premise to Exchange Online migrations, I came across a small client who had disabled the following setting for the majority of their users:

Automatically update email addresses based on the email address policy applied to this recipient

This meant that after I had set up the Exchange Hybrid configuration, the desiredĀ tenant.mail.onmicrosoft.com proxyAddress was not created so routing between the on-premise Exchange and Exchange Online did not work. There were only around 70 users in the organization so it wasn’t really a big deal to manually add it or better yet, create the desired address policies so this default configuration can be turned back on.

The client did not want to spend time creating and testing the address policies that would provide the customizations the organization needed so I suggested using a PowerShell script to export every users:

  1. First Name
  2. Last Name
  3. Primary Email Address

Then create an extra column with the O365 coexistence email address.

The export looks as such:

A person familiar with users in the organization can review the list, make modifications, then use the same Excel xlsx file to create the definedĀ O365 Coexistence Email Address.

Note that this script doesn’t necessarily need to be used to create the tenant.mail.onmicrosoft.com proxyAddress but also any other email address that is desired.

The two scripts can be found on my GitHub Repo here:

Extract Users from On-Premise AD

https://github.com/terenceluk/Active-Directory/blob/main/Exchange/Exchange-Extract-Primary-ProxyEmailAddress.ps1

Import Updated Excel spreadsheet into On-Premise AD

https://github.com/terenceluk/Active-Directory/blob/main/Exchange/Exchange-Import-O365-ProxyEmailAddress.ps1