How can I Export OUs from my Active Directory?

Dear Sir,

I've just set up a new Windows Server 2003 domain on a new machine, and I need to export all organization unit in my AD to .txt or to .ldf file.

What's the proper export/import commands using "ldifde" for this?  I've read up on it and I'm still not certain what the parameters in my case would be.

How can I export all OUs or specific OU in my Active Directory.

Please any help?

Thank you in advance,
LVL 1
ISC-IT-AdminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

questionCommented:
here is the command
ldifde -f exportOu.ldf -s Server1 -d "dc=Export,dc=com" -p subtree -r "(objectCategory=organizationalUnit)" -l "cn,objectclass,ou"

see the below link and this can come handy like a true friend:

http://support.microsoft.com/kb/237677
0
JoWickermanCommented:
Hi ISC-IT-Admin,

This article explains all switches nicely with examples:

http://www.computerperformance.co.uk/Logon/Logon_CSVDE_Export.htm

Cheers.
0
questionCommented:
You can also check the below link for ldifde if my above command and the link information are not sufficient.
The below link is similar to what the expert JoWickerman has provided.
http://www.computerperformance.co.uk/Logon/Logon_LDIFDE_Export.html

There are a number of ways you can query AD.
LDIFDE, CSVDE and the newer one DSQUERY which is far simple which is extra powerful as well.
i use dsquery on a daily basis on all clients reporting.
http://www.computerperformance.co.uk/ezine/ezine66.htm

Also you can use the tool 'ADFIND' from joeware which you can get from
http://www.joeware.net/freetools/tools/adfind/
This is for all advanced queries you may need.
whic
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

questionCommented:
Also below is something that you can use as a stick it---

Windows Server 2003's directory service command-line tools

****************************************************************************

Command ------------------------------- Description
Dsadd computer
Dsadd contact
Dsadd group ..............................Adds objects to the directory
Dsadd ou
Dsadd quota
Dsadd user

Dsget computer
Dsget contact
Dsget group
Dsget ou
Dsget partition
Dsget quota .............................. Displays properties of objects in the directory
Dsget server
Dsget site
Dsget subnet
Dsget user

Dsmod computer
Dsmod contact
Dsmod group
Dsmod ou .............................. Modifies select attributes of an existing object in the directory
Dsmod partition
Dsmod quota
Dsmod server
Dsmod user

Dsquery *
Dsquery computer
Dsquery contact
Dsquery group
Dsquery ou
Dsquery partition
Dsquery quota ..............................Finds objects in the directory that match a specified search criteria
Dsquery server
Dsquery site
Dsquery subnet
Dsquery user

Dsmove .......................Moves any object from its current location to a new parent location or renames any object without moving it

Dsrm ....................... Removes an object, the complete subtree under an object in the directory, or both

****************************************************************************

LDAP attribute tag ------------------ Description
CN= .............................................Common name
.....................................................The name given to the object at creation
OU=................................................Organizational unit
....................................................The name of the container
DC=................................................Domain component
......................................................The name of the domain



dsquery ou dc=abc,dc=com
This command will produce a listing of all OUs

dsquery user cn=users,dc=abc,dc.com
It is going to show all the users in the users container.

dsquery servers -hasfsmo schema or (rid, name, infr and pdc.)
It is going to show which server(s) has the schema role

*****************************************

dsadd ou "ou=northwest, dc=abc, dc=com"
This command tells Active Directory to create an OU called northwest

dsadd user "cn=calvin jay, ou=northwest, dc=abc, dc=com"
This command will create an user named calvin jay in northwest OU

*****************************************

dsquery server -domain abc.com | dsget server -dnsname site
Finds all domain controllers for domain abc.com and display their DNS host name and site name

dsget user "CN=Mike Jay,CN=users,dc=abc,dc=com"-memberof expand
Shows the list of groups, recursively expanded, to which a given user belongs

*****************************************

dsmod computer CN=Server1,CN=Computers,DC=abc,DC=Com -disabled yes
To disable computer account

dsmod user "CN=Don Jay,CN=Users,DC=abc,DC=Com" -pwd A1b2c3d4 -mustchpwd yes
To reset password and force him to change his password the next time he logs on to the network

*****************************************

dsmove "CN=Kim love,OU=Sales,DC=abc,DC=Com" -newname "Kim Falls"
Renames a user object from Kim Love to Kim Falls

dsmove "CN=Kim Falls,OU=Sales,DC=abc,DC=Com" -newparent OU=Marketing,DC=abc,DC=Com
Moves Kim Falls from the Sales organization to the Marketing organization

*****************************************

dsrm -subtree -noprompt -c OU=Marketing,DC=abc,DC=Com
Removes an organizational unit called "Marketing" and all the objects under that organizational unit

dsrm -subtree -exclude -noprompt -c "OU=Marketing,DC=abc,DC=Com"
Removes all objects under the organizational unit called "Marketing," but leaves the organizational unit intact
0
Milan_OjhCommented:
1. First import from Windows 2000 domain.

Ldifde.exe -f alluser.ldf

2. Edit alluser.ldf and change the domain and OU name.

3. Ldifide -i alluser.ldf.

Above command should import users in 2003 domain. Please note that I haven't tested this but it should work.

Check out here:

http://support.microsoft.com/kb/555634
http://support.microsoft.com/kb/555637
0
ISC-IT-AdminAuthor Commented:
Hello Question,

When I am running this command on my Domain Controler:
ldifde -f exportOu.ldf -s DOMAIN -d "dc=Export,dc=com" -p subtree -r "(objectCategory=organizationalUnit)" -l "cn,objectclass,ou"

This is the result:
No Entries Found.... How??

I am opening the exportou.ldf with Notepad but its empty

Any Help?
0
ISC-IT-AdminAuthor Commented:
I don't Have Windows 2000 Domain...
0
ISC-IT-AdminAuthor Commented:
I don't want to export users, I need to Export all my OUs design structure and import them somewhere else...

Thank you,
0
JoWickermanCommented:
Hi.

Did you replace the

"(objectCategory=organizationalUnit)" -l "cn,objectclass,ou"

with your OU's real name?
0
ISC-IT-AdminAuthor Commented:
Hello joWickerman,

NO I didn't replace with my OU's real name.
Could you give me an example pls?

I need to specify all OUs?
0
JoWickermanCommented:
Try:

CSVDE -d "OU=yourOU,DC=yourdomain,dc=com" -f filename.csv

This will export the particular OU you specified.

You can do this for all OU's
0
questionCommented:
do you want to try this one if you dont have 2000 dcs
dsquery ou dc=export,dc=com

may be if you want you can pipe it to atext file
dsquery ou dc=export,dc=com >>ou.txt

after you get the list of ou's then to add them on the new server:
with the ou details from the text file.
dsadd ou "ou=northwest, dc=export, dc=com"

you can use excel and use the concatenate function to fall things in place.
0
ISC-IT-AdminAuthor Commented:
Hello JoWickerman,

I tried,

CSVDE -d "OU=ISC KHC,DC=Domain" -f filename.csv     [Without DC=com, because my domain is crearted without the .com or .local...)

The result is no Entries....


0
ISC-IT-AdminAuthor Commented:
Hello question,

Pls could you give a real example:
First my domain is without the .local or .com...
My domain is  [ISCADKC] only

So the command should be like?

0
questionCommented:
just throw a command 'dsquery user' and you will get the complete domain component.
  you can use it here in the command
0
ISC-IT-AdminAuthor Commented:
IF I need only the OU's not users.
Can I use dsquery?

Thanks,
0
JoWickermanCommented:
Ok:

CSVDE -d "OU=Admin,DC=ISCADKC,dc=" -f filename.csv

This should export a OU called Admin for your domain.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ISC-IT-AdminAuthor Commented:
Thx JoWickerman,

The exact command was:

CSVDE -d "OU=XXX,DC=ISCADKC" -f filename.csv

I want to send the filename.csv to another branch location.

How can I import it into another organization Domain?


0
JoWickermanCommented:
Cool.

Use:

CSVDE -i -f filename.csv

This should import the OU.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.

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.