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

x
?
Solved

Active directory creating a new OU using a text file and LDIFDE

Posted on 2006-10-22
11
Medium Priority
?
2,722 Views
Last Modified: 2012-08-14
I am trying to create a new OU in my active directory using a texted based file and LDIFDE i have created new users with no problem and I have created a new OU using WSH in a cmd line but Iam unable to find the syntax for creating a new OU in active directory searched all over the net and in lots of books but no luck yet can some one point me in the right direction.
0
Comment
Question by:carlpotter
[X]
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
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 48

Assisted Solution

by:Jay_Jay70
Jay_Jay70 earned 300 total points
ID: 17783493
use dsadd, example below creates an OU James at the root of the domain.Com Domain

dsadd OU "OU=James,DC=Domain,DC=Com"
0
 
LVL 1

Author Comment

by:carlpotter
ID: 17790845
Sorry maybe I should of included this sample of what i have done so far.the code below is a sample of the LDIFDE file created in notepad this creates a new user called John Doe in the OU Training within the schoolsite.org.uk domain. what I want to do is Create an OU in schoolsite.org.uk using this method and then create another OU inside the first (nesting them) If i put your line of code into the Newuser.ldf text file for the ldifde command to read it produces the error below. Hope this has clarified my problem.

Error: There is a syntax error in the input file Failed on line 1

Sample code:
DN:CN=John Doe,OU=Training,DC=schoolsite,DC=org,DC=uk
changetype:add
CN:John Doe
objectClass:User


Command line used to import the LDIFDE file:  ldifde -i -f Newuser.ldf
0
 
LVL 48

Expert Comment

by:Jay_Jay70
ID: 17792621
ahh i see i see,

you probably need to create more of a script, create your OU with the dsadd commands, then call the ldifde command which can pull the file, however, there may a simpler way and i will see if i can get some help
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 71

Accepted Solution

by:
Chris Dent earned 300 total points
ID: 17794254

This is how you create an OU using LDIFDE:

dn: OU=Some OU Name,DC=YourDomain,DC=local
changetype: add
objectClass: top
objectClass: organizationalUnit
ou: Some OU Name

If you're creating Nested OUs then you're going to have to create them in order.

Once done you can import the file with:

ldifde -i -f ImportOU.ldf -s ServerName

I think that all works.

Chris
0
 
LVL 1

Author Comment

by:carlpotter
ID: 17799034
The code you sent did not quiet work but with a few changes it now works. The code below creates three new OUs all nested inside the lancaster OU. One artical I read suggested that you needed a hyphen then a line between each block of code but I found on the virtual server2003 this did not work but with out the dash it works great. thanks for the help

dn: OU=Lancaster,DC=DomainName,DC=org,DC=uk
changetype: add
objectClass: top
objectClass: organizationalUnit
ou: Lancaster

dn: OU=AdminOU,OU=Lancaster,DC=DomainName,DC=org,DC=uk
changetype: add
objectClass: top
objectClass: organizationalUnit
ou: AdminOU

dn: OU=StudentsOU,OU=Lancaster,DC=DomainName,DC=org,DC=uk
changetype: add
objectClass: top
objectClass: organizationalUnit
ou: StudentsOU

dn: OU=TrainingOU,OU=Lancaster,DC=DomainName,DC=org,DC=uk
changetype: add
objectClass: top
objectClass: organizationalUnit
ou: TrainingOU
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 17799833

Glad you've got it working :)

I'm afraid I'm not so good with the standard import / export tools; bad habits I've developed.

Chris
0
 
LVL 48

Expert Comment

by:Jay_Jay70
ID: 17799888
Thanks for the help Chris
0
 
LVL 1

Author Comment

by:carlpotter
ID: 17807680
Thanks to both of you neither was the definitive answer but both were a great help.
0
 
LVL 48

Expert Comment

by:Jay_Jay70
ID: 17807904
Thanks :)
0
 

Expert Comment

by:Jamie McCarthy
ID: 26372039
If you are at a command prompt on the domain controller its simplifies down to

        ldifde -i -f ImportOU.ldf
0
 

Expert Comment

by:rahuldevsingh
ID: 32640561
its very nice
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
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