Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1722
  • Last Modified:

Importing legacyexchangedn from csv file

My company has split from it's parent organization and I am migrating our users to a new 2007 Exchange server. I have a csv file of (new) smtp addresses and the old legacyexchangedn data to import into the new Exchange attributes. I would like to have the users be able to reply to migrated emails and continue to function seamlessly with existing calendar appointments.

Can anyone tell me the correct syntax to import a file with smtp address and add the old x500 information?
  • 4
  • 2
1 Solution
you got it exactly right that X500 should be added as legacyexchangedn value for replying to old emails (emails sent to you when mailboxes existed in previous organization)

However, this x500 value needs to be added in proxyAddresses - in other words your email address gets modified with another secondary email address added. No need to panic since this is an X500 address and not a modification to primary SMTP address. Mentioned below are the steps taken using the tool ADMODIFY to make bulk user changes.


1] Open ADModify.NET with an account that has Domain Admin permissions and select Modify Attributes
2] From the Domain List: drop down box, choose the Domain you will work with.
3] From the Domain Controllers List: drop down box, choose the Domain controller you will work with.
4] Place or remove checkmarks to select the mail enabled objects you wish to modify.
5] Select the arrow to the right to search the domain.
6] From the search results select the OU you want to work with and select, Add To List->
7] You can highlight individual Users from the details pane on the right or choose Select All.
8] Select NEXT; a new screen will appear, select the CUSTOM Tab
9] Under Custom Attribute Set, place a check mark by: Make a customized modification
10] By Attribute Name: enter: proxyAddresses
11] By Attribute Value: enter the X500 address

For example, if you want an X500 address of:

Then for Attribute Value enter:

In this example the %'mailnickname'% variable is used because it is assumed that
the Users mailnickname attribute, in the new Organization, matches the mailnickname
attribute in the old Organization. If not, other variables can be used for this

12] In order to add the X500 proxy address to the existing proxyAddresses place a
check mark by: Multivalued Append
13] Select GO!
susjdavisAuthor Commented:
Unfortunatley - there is no standard on the old x500 addresses for the %nickname% field. I have at least three differnent naming conventions coming from the old exchange org and none of the three match the current (firstinitiallastname) alias in the new AD domain.
I had found the following on the net explaining how to import via a csv file if you had the correct alias and legacyExchangedn:

Import-CSV file.csv | foreach {

$Temp = Get-Mailbox -identity $_.alias

$Temp.EmailAddresses += X500 + $_.legacyexchangedn

set-mailbox -instance $temp}


However - I'm not 100% on using the smtp address as the unique identifier instead of the alias name.
I'm also getting errors when trying to test the script at the $temp.emailaddresses.
"Unfortunately - there is no standard on the old x500 addresses for the %nickname% field. I have at least three differnent naming conventions coming from the old exchange org and none of the three match the current (firstinitiallastname) alias in the new AD domain"

Look, it seems either you are confused or i am feeling sleepy. X500 over the years has always been used in context with mailNickname attribute. This attribute derives from only one attribute that is ALIAS.

The change i asked you to make using adsiedit was keeping in mind that your present alias would match your previous Org alias.

What you are stating that you have THREE naming convention - this is practically impossible - since Exchange would pickup ONLY ALIAS Attribute for its own mailNickname - You cannot have 3 types of alias and mailNickname.

The fact that i wanted to share these steps with you was - since this has worked without an hitch on previous occasions.

Yes, if you current alias is different then your script would also Fail - i would also answer that why.

Import-CSV file.csv | foreach {

$Temp = Get-Mailbox -identity $_.alias <=== This is trying to store the present alias
(which as per you is not the same as previous organization) - so why proceed to step2

$Temp.EmailAddresses += X500 + $_.legacyexchangedn <==== This is storing the legacyexchangedn value with x500 attached to it. - LegacyExchangeDN would require mailNickname at the end of its value.

set-mailbox -instance $temp}
At this point probably you are trying to merge both the information. Which should be incorrect since you stated.

"I have at least three differnent naming conventions coming from the old exchange org and none of the three match the current (firstinitiallastname) alias in the new AD domain."

I am again stating please do not confuse between mailNickname attribute and email address - Both these are different.
Email address derive their proxyaddress from recipient polices.
mailNickname derives its presence from alias and helps further only in legacyExchangeDN value.
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

And yes i did confirm with my colleagues in MSFT - your script and my method are practically the same.
Just that i would be using the GUI and script would show you the shell interface.
susjdavisAuthor Commented:
My organization has gone through at least three cross-organization exchange migrations in the past few years. Currently, the mail boxes are being hosted on another domain at a hosting facility.

The legacyExchangeDN on the hosted mailboxes "nicknames" are from the trusted domain and not the domain I will be migrating into. They range from firstname.last, firstname lastname, firstname, firstinitiallastname, etc. These mailboxes have been migrated several times.

My question is - is there a way to MODIFY the above script to pull in legacyexchangedn from a csv file with two columns:
smtp address (since I do not have the correct alias')
Not to a limit i am aware of. You may open a case with MSFT for this - but i doubt they can do anything better on such scenarios.

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now