Importing an OU Structure from Excel

0 Likes

Problem



A Forum reader recently asked:



"I have a list of the entire OU structure in an Excel document. I want to do an LDIF import of the OU structure, creating each OU for me. How can this be done? "



And here are suggestions from Edward van der Maas and Aaron Burgemeister ...



Solution



Edward van der Maas



Create something like this:



version: 1

dn: ou=org1,o=Novell
changetype: add
ou: org1
objectClass: organizationalUnit
objectClass: ndsLoginProperties
objectClass: ndsContainerLoginProperties
objectClass: Top
objectClass: Partition

dn: ou=org2,o=Novell
changetype: add
ou: org2
objectClass: organizationalUnit
objectClass: ndsLoginProperties
objectClass: ndsContainerLoginProperties
objectClass: Top





Aaron Burgemeister



It depends on what the Excel document has it in specifically, and in what format, and how complete it is. You may be able to use ICE (Import Convert Export) via ConsoleOne or iManager (or even the command line) to import directly from a CSV format, but I would prefer to create an LDIF from the file. Excel equations could be used to create the LDIF, as follows:



A1, ouShortName
B1, ouContext
C1, ="dn: " A1 "," B1 vbCrLf "changetype: add" vbCrLf "ou:
" A1 vbCrLf "objectClass: organizationalUnit" vbCrLf
"objectClass: ndsLoginProperties" vbCrLf "objectClass:
ndsContainerLoginProperties" vbCrLf "objectClass: Top" vbCrLf vbCrLf


In case it is not apparent, the 'vbCrLf' is supposed to create a new line. This would create an LDIF similar to the one Edward created as an example, and would only require you have the short name of the OUs in one column and the context for them in another (on the same row). The forumla could then be "filled down," and you could copy/paste the entire thing to a file (that entire third column, I mean) and run it.

Labels:

How To-Best Practice
Comment List
Anonymous
Related Discussions
Recommended