Importing LDIFs

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
givenName: Firstnam
sn: Lastnam
cn: Lastnam Firstname (FLASTNAM)
Who is Participating?
fishadrConnect With a Mentor Commented:
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:
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.
Godbrain666Author Commented:
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.
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.

Godbrain666Author Commented:
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...
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!
Godbrain666Author Commented:
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?  
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
Godbrain666Author Commented:
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.
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.
Godbrain666Author Commented:
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.
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.
Godbrain666Author Commented:
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.
Godbrain666Author Commented:
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!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.