Wednesday, May 18, 2022
  • Home

Creating X500 addresses in Office365/Exchange Online using PowerShell

March 4th, 2014 by Jabez Gan [MVP]

Recently I was doing an email migration from Exchange On-premise to Office365, and the customer’s environment is not suitable to use Dirsync.

This means that I will need to export the X500 address from my local Active Directory and import it into Office365.

Here is the brief steps if you are facing this issue:

Export the LegacyExchangeDN and mail field in your AD:
1. In your DC server, run Command Prompt
2. Run the command:
csvde -f c:\sample.csv -l legacyexchangedn,mail

Now, with that .csv file, make sure that it has a “mail” and “legacyexchangedn” under the heading. See my attached sample file: sample CSV with LegacyExchangeDN

Import the legacyexchangedn/X500 into Office365/Exchange Online using PowerShell:

1. Connect to Exchange Online. using PowerShell
2. Run the command:


Import-CSV C:\sample.csv | foreach {

$user=Get-Mailbox $_.mail

Set-Mailbox $_.mail -EmailAddresses $user.EmailAddresses



To check if the address has been added:
Get-Mailbox $user | FL emailaddresses

Posted in MS News | Comments Off on Creating X500 addresses in Office365/Exchange Online using PowerShell

This entry was posted on Tuesday, March 4th, 2014 at 2:49 am and is filed under MS News. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.