Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Importing LDIFs

Posted on 2008-06-26
Medium Priority
Last Modified: 2010-04-21
I have received an LDIF from our parent company, and am trying to figure out the best way to import it into Exchange 2003 (rather than a suggested method of importing it into everyone's Outlook individually).  Is there a way to import them into the GAL without creating each person as a contact?  The only information we truly need this for is to be able to look up a person's phone number, and of course, the ability to call up e-mail addresses within Outlook.

Here's a (modified) sample:

dn: CN=Lastnam Firstnam (FLASTNAM), OU=TST, OU=Users, OU=Secretlands, DC=comp
telephoneNumber: 555 555 1212
mail: FLASTNAM@company.com
givenName: Firstnam
sn: Lastnam
cn: Lastnam Firstname (FLASTNAM)
Question by:Godbrain666
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
LVL 15

Expert Comment

ID: 21875677
You have to import the external users as contacts in Active Diectory, you cannot import them to Exchange 2003. If you hide them from the GAL then users will not be able to view them and find them in Outlook. If you import them as contacts they will be displayed with a different icon, I also tend to import nad place (External) next to the name so that this identifies them as external contacts to the users.



Author Comment

ID: 21875811
Is there anything I should know while trying to import since the domain names are different?  I've looked into it before, and I think LDIFDE won't support changing things such as DC, but I believe CSVDE needs the file to be in a CSV format, which this is not.  I'm *really* not very good at scripting, but I certainly don't want to import 2,000 contacts by hand.

Author Comment

ID: 21883369
I've toyed around a bit with LDIFDE and CSVDE, and it seems that I can't get either to work with the data I currently have.  *EVERY* entry is the same format and information that is listed in the example... it seems as if I would have to modify the data /greatly/ in order to be able to use either tool to import that data back in.  

It just seems like there should be an easier way, since Outlook Express can import that data very, very easily...
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

LVL 15

Expert Comment

ID: 21883585
You will more than likely have to manipulate the data prior to importing this. However this is not normally as bad as it may seem.

You can use Notepad to do a search for specific parts of the text and then replace it
ie. with the following:
dn: CN=Lastnam Firstnam (FLASTNAM), OU=TST, OU=Users, OU=Secretlands, DC=company,DC=com

You could do a search for:
OU=TST, OU=Users, OU=Secretlands, DC=comp any,DC=company,DC=com
and replace with:
OU=ExternalContacts, OU=LiveDomain, DC=LiveDC,DC=Live,DC=com

You can also import the csv in to Excel and merge cells using Concatenate etc (Check help in Excel)

It is not that bad!

Author Comment

ID: 21884069
I've created a few small tests, and just can't seem to get it to go with LDIFDE... I'll try to merge everything using Excel and see if CSVDE has any more luck.

The issue I'm having right now seems to be some kind of syntax error.  Can anyone see anything wrong with the syntax of it (It says line 3, which in the one I'm working with would be the MAIL line).  Is the syntax used in this file good for *either* LDIFDE or CSVDE?  Or should I ask for another export using these tools?  What would the filters be to get *just* the information I would need for contacts?  
LVL 15

Expert Comment

ID: 21884639
Try the following:

dn: cn=LastName\, FirstName,ou=Contacts,dc=myDomain,dc=co,dc=uk
changetype: add
objectclass: contact
cn: LastName, FirstName
sn: LastName
givenName: FirstName
DisplayName: LastName, FirstName

Replace the LastName, FirstName with real names and set the correct ou and dc options on the 1st line

Author Comment

ID: 21884715
Well... although I'm 99% certain the example given would work... I'd basically be recreating the entire file, which contains about 1,500 contacts.  I would basically be scrapping the LDIF I currently have.  In the end, it seems like I would be better off just creating each contact manually.
LVL 15

Expert Comment

ID: 21884773
I have done this quite a few times, you can edit the file in Excel and use the search and replace options along with concatenate options to merge information such as firstname and lastname etc in to a new column and then paste the lot in to a new file and import.

It might take you a short time to get used to manipulting the data but once you have it mastered it will only take you a few minutes the next time.

The manual option is not a good idea - it will take you ages.

Author Comment

ID: 21886501
Strange... my last post didn't show up...

My main concern at this point is that doing it this way will make a non-mail enabled contact with no phone number, so I would still have to manually edit everything.  Is there a "find and replace" for doing those as well?  I've looked at importing it into Excel, and the file I have has a 77-character "break" (COMP at the end of line one is the beginning of "COMPANY" which continues on line 2).  So first, I'd have to manually go through the document deleting two spaces to put that all on one line again, THEN import everything, THEN try to figure out how to use Excel in the way you described.  I just can't see how this is *less* work than simply printing out the list and creating each one manually... or even importing the LDIF into Outlook.
LVL 15

Expert Comment

ID: 21887759
You can import pretty much anything including the phone numbers in to AD.

Using Excel you can do some pretty clever checking for data and joining it or replacing it from certain points. I would be suprised that if you spent a short time learning the manipultion part you would be able to convert the file within five to ten minutes. Once you get your head round it, it is pretty striaght forward and the whole process will be much faster than manual addition.

The following article has some good examples of manipulating data in Excel.

Author Comment

ID: 21926879
From what I've seen, there may be a better solution through some scripting that will import the data "as is".  Does anyone have any further input on this topic?  After looking at the file, the amount of data manipulation needed for this current solution is prohibitive when weighed against the time savings I would gain by not manually entering each user instead.
LVL 15

Accepted Solution

fishadr earned 800 total points
ID: 21931627
I write scripts using perl and vbscript, depending on what I need to do I will either use something like Excel to manipulate the data (as it is fast and powerful for this job). If there are complexities then I will create a quick script to read the data in to script and manipulate it out in the format that I want so that it can be imported using ldifde etc or I will load it straight in to AD.

There is no quick solution to this, you need to invest a little time learning Excel and scripting and then you will save administration time

The following has some good examples for you to manipulate data using scripts:

and the following is reference information


The following is also good VBscript reference:

Author Closing Comment

ID: 31470978
Although the answer wasn't 100% what I was hoping for, it's as good of an answer as I'm going to get.  I appreciate all the help.  Wish me luck!

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A couple of months ago we ran into an issue that necessitated re-creating our Edge Subscriptions. However, when we attempted to execute the command: New-EdgeSubscription -filename C:\NewEdgeSub_01.xml we received an error indicating that the LDAP se…
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question