Monday, March 27, 2017
  • 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
$user.EmailAddresses+=”X500:”+$_.legacyExchangeDN

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