Inter-Org Distribution List Migration

I had this post on at my previous blog and also at MSD2D, but I think it makes sense in putting it here also. You can download the code here.

Almost 40% of the current Microsoft Exchange customers are still using Exchange 5.5. Probably most of them have plans to migrate to the latest version, Exchange 2003 SP1, in the near future. There is lots of literature available about the right procedures for such a task, so if we’re not talking about something very complex, the migration process should be painless.

One of the difficulties you should be aware of (and now I’m speaking particularly for those who are about to migrate) is the migration of the old Exchange 5.5 Distribution Lists (DLs) to the new Universal Distribution Groups (UDGs) in Active Directory, when in an inter-organization scenario.

Migrating DLs in the same organization doesn’ http:

The only way I know to migrate DLs in this scenario (without using third party tools) is by exporting the DLs, and then using the LDIFDE or CSVDE command-line utilities to convert them to UDGs.

I had recently the opportunity to work on a client who needed this DL migration process, so a couple of colleagues of mine, Paulo Lopes and Paulo R. Lopes (they’re not related, before you ask), with a little contribution from myself, came up with the method I’ll describe next.

You can run the following command to perform a DL export from an Exchange 5.5 server (E55SERVER) in a Windows NT 4.0 Domain (NT4DOMAIN), using an NT4 account (NT4ACCOUNT) as the credentials:

ldifde -m -f DL_E55_NT4DOMAIN_OUT.txt -s E55SERVER -u -r “(objectClass=groupOfNames)” -l objectClass,rdn,cn,mail,otherMailbox,Extension-Attribute-1,Extension-Attribute-2,Extension-Attribute-3,Extension-Attribute-4,Extension-Attribute-5,Extension-Attribute-6,Extension-Attribute-7,Extension-Attribute-8,Extension-Attribute-9,Extension-Attribute-10,Extension-Attribute-11,Extension-Attribute-12,Extension-Attribute-13,Extension-Attribute-14,Extension-Attribute-15,textEncodedORaddress,uid,member -b NT4ACCOUNT NT4DOMAIN *

Then you must run a CSVDE export, in order to get the right Display Name:

csvde -f MB_E55_NT4DOMAIN.txt -s E55SERVER -u -r “(objectClass=*)” -l
objectClass,Admin-Display-Name,rdn,cn -b NTACCOUNT NT4DOMAIN *

The last step to import the DLs to Active Directory is to run LDIFDE again, using a global catalog server (GCSERVER):
ldifde -i -f DL_E55_NT4DOMAIN_IN.txt -s GCSERVER -j .\

The main problem with this method is that you’ll have to do some tweaking on those LDFIDE and CSVDE files in order to import them properly to the Active Directory. This can become a long, long time-consuming task (I know, I’ve been there). So I decided to create a script in order to automate this process.

Here is a brief description of what the script does:
1. Extracts Distribution Lists to a file using LDIFDE; 2. Extracts Exchange 5.5 Directory to a file using CSVDE (this is only necessary to match a user’s display name to his account name); 3. Modifies the first extracted file so that it can be imported using LDIFDE. Here is where the script does all its magic; 4. Imports DLs to Active directory as UDGs.

You still have to use ADC to synchronize the GAL. In fact, you must first import Exchange 5.5 users if you want the migrated DLs to be populated. So I strongly advise you to read the following KB article:

XGEN: How to Configure a Two-Way Recipient Connection Agreement for Exchange Server 5.5 User

Don’t forget that before you can run the script, you’ll have to modify the following variables:

strDN: the Distinguished Name of the destination OU
E55Server: the Exchange 5.5 server
GCServer: the Global Catalog server
NTUser: the NT User Account to connect to the source domain
NTDomain: the NT source domain

I don’t wish to bother you with one of those big disclaimers about responsibility or copyright, so I’ll just say that I’m offering you this script with the best of intentions, but you should always test before doing anything that can compromise your production environment. Besides that, feel free to distribute it to all your friends and to modify it, although I would appreciate that you drop me an email in case of new improvements.

Any feedback is always welcome.

You should also know that there are some issues with this tool:

Issues so far with the Inter-Org DL Migration Script

So far, these are the known issues with the script:

#1- Hidden DLs won’t migrate
Solution 1: unhide all objects before running the script
Solution 2 (not tested yet): try an LDAP filter on the LDIFDE command. Modify the command after the -r switch:
[…] -r “(&(objectClass=groupOfNames)(msExchHideFromAddressLists=TRUE))” […]
You can find more information about LDIFDE in the following KB article:
Using LDIFDE to Import and Export Directory Objects to Active Directory
Then you can use the same filter with CSVDE.
Of course you’ll have to run the commands outside the script.

#2- You get an empty file when you run the CSVDE command
Solution 1: modify the LDAP properties on Exchange 5.5, so that you can search more than the default number of items
Solution 2: run the CSVDE command directly on the Exchange 5.5 server (only supported on Windows 2000 Server).

#3- You cannot run the CSVDE command
Solution 1: check the permissions. Are you using an NT account with the propper permissions?
Solution 2: integrate WINS. Try replicating the WINS information from the NT domain to your current WINS server. You might prefer using an lmhosts file.
Solution 3: run the CSVDE command directly on the Exchange 5.5 server (only supported on Windows 2000 Server), then copy the file to server where you’re running the script.
Solution 4 (not tested yet): try to do a directory export using Exchange Admin. Make sure you have the following fields:
Take a look at Q155414 and Q261112 articles for an explanation on how to select field headers.

Any feedback about these issues is welcome. You can reach me by posting a comment here, or by the email address provided inside the script.

23 thoughts on “Inter-Org Distribution List Migration”

  1. I am not a scripting guru. But, when I ran the script I got an "ERROR: Wrong file format". So, I took the "On Error Resume Next" out and it gave me an "Invalid procedure call or argument" ‘Left’" on Line 116 Char 13.

    Any ideas?



  2. Hi Chris.

    Can you check if you have the file DL_E55_NT4DOMAIN_OUT.txt and if it has content?

    If this file has no content, then the first step of the script did not finish successfully.

  3. Yes, there is stuff in all of the files. The formats look correct to. I might try to manually import the file and see if I get an error there. If you have an insight I would appreciate it but, if not I will get it done on my own even if I have to recreate the DLs. Thank you for providing such a script though.

  4. Mark, I tested the script with empty DLs, so I don’t think the problem has to do with the number of members. Can you confirm that you have a valid DL_E55_NT4DOMAIN_OUT.txt file?

  5. Im getting the same error when i run the script. WRONG FILE FORMAT. A window comes up, status bar goes to 19% and then i get the error. All the files have data in them. Any idea on how to fix this error?

  6. This looks to be a truly useful tool – its just what i need but can’t get the CSVDE step2 to work, against an Ex55 Sp4 machine running on NT4Sp6a – the command completes succesfully, but i get "No Entries Found"

    The Admin-Display-Name, rdn and cn entries dont seem to be recognised in an Exchange 5.5 directory export either. If I try and do an export to these headers, i get nothing out either? Any ideas gratefully recieved..!

  7. Hi,

    When running this CSVDE command against NT4/Ex55 SP6a, you must change the properties of the LDAP protocol in Exchange 5.5 to "Allow all substring searches (slow)".

    Additionally, within i would extend the provided CSVDE command used here with -d "RootDN" and -p SearchScope.


  8. change => groupType: 214748640

    somehow the groupType of 8 doesn’t work (win/exch 2003)

    add => mailNickname:

    this makes the new group mail enabled

    remove => otherMailbox

    this will be added by the Exchange RUS ; exchange 5.5 often uses some extra (garbage) address templates like fax or something. the tool fails when those templates don’t exist in the target environment

  9. Hi,

    Great script (if it works), just what I needed!

    I did run into a few problems mentioned earlier, but those could be solved quite easy thanks to the comments above (the CSVDE dit not work from a remote server and some lines in the LDIFDE output file where not alligned -> seems to happen a lot with ldifde).

    Still I would like to share the following findings:

    – The W2K3 version of LDIFDE seems to give a different output compared to the W2K one and causes the script to fail

    – The group members need to be in the same target OU as the distribution groups

    Does anyone know if there’s an updated version of this script, or a simular tool somewhere?


  10. To Exchange Guy:

    – I’ve tested the tool with W2K3 with success, never had a problem

    – The lates version is 0.3.20, which is the one I provided the link to download from

    – Regarding the target OU, this process it’s supposed to occur after a migration with ADC sync involved, so I designed it to use the ADC OU. You can move the objects after running the script

  11. I’ve tried using this script but I always get the Wrong File Format error, and I have tried the changes to the script suggested above. Our ADC is in place, I ran the CSVDE from the Exch 5.5 server on Windows 2000, then copied the results over to the Windows 2003 DC and tried completing it there as well, but it only created an empty IN file and failed to import.

    Any ideas?

  12. I used the script and recd wrong file format error. I manage to identify few DL which causes the above error. So i deleted from out and MB file, afterthat IN files created successfully. Now i am getting following error while importing

    Importing directory from file “DL_E55_rtl_ho_IN.txt”
    Loading entries.
    Add error on line 1: No Such Object
    The server side error is “Directory object not found.”
    0 entries modified successfully.
    An error has occurred in the program

    Can you help on this!!!!


  13. I would like to try this script, but I can’t download it (HTTP Error 404). Could you upload it once again?
    Thx in advance.

Leave a Reply to Mark Boeser Cancel reply

Your email address will not be published. Required fields are marked *