?
Solved

How can I Export OUs from my Active Directory?

Posted on 2008-11-18
19
Medium Priority
?
878 Views
Last Modified: 2012-05-05
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,
0
Comment
Question by:ISC-IT-Admin
  • 8
  • 5
  • 5
  • +1
19 Comments
 
LVL 6

Expert Comment

by:question
ID: 22991791
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
 
LVL 16

Expert Comment

by:JoWickerman
ID: 22991793
Hi ISC-IT-Admin,

This article explains all switches nicely with examples:

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

Cheers.
0
 
LVL 6

Expert Comment

by:question
ID: 22991837
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:question
ID: 22991890
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
 
LVL 8

Expert Comment

by:Milan_Ojh
ID: 22991993
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
 
LVL 1

Author Comment

by:ISC-IT-Admin
ID: 22991997
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
 
LVL 1

Author Comment

by:ISC-IT-Admin
ID: 22992002
I don't Have Windows 2000 Domain...
0
 
LVL 1

Author Comment

by:ISC-IT-Admin
ID: 22992014
I don't want to export users, I need to Export all my OUs design structure and import them somewhere else...

Thank you,
0
 
LVL 16

Expert Comment

by:JoWickerman
ID: 22992015
Hi.

Did you replace the

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

with your OU's real name?
0
 
LVL 1

Author Comment

by:ISC-IT-Admin
ID: 22992028
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
 
LVL 16

Expert Comment

by:JoWickerman
ID: 22992035
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
 
LVL 6

Expert Comment

by:question
ID: 22992059
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
 
LVL 1

Author Comment

by:ISC-IT-Admin
ID: 22992114
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
 
LVL 1

Author Comment

by:ISC-IT-Admin
ID: 22992133
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
 
LVL 6

Expert Comment

by:question
ID: 22992135
just throw a command 'dsquery user' and you will get the complete domain component.
  you can use it here in the command
0
 
LVL 1

Author Comment

by:ISC-IT-Admin
ID: 22992166
IF I need only the OU's not users.
Can I use dsquery?

Thanks,
0
 
LVL 16

Accepted Solution

by:
JoWickerman earned 1500 total points
ID: 22992181
Ok:

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

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

Author Comment

by:ISC-IT-Admin
ID: 22992204
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
 
LVL 16

Expert Comment

by:JoWickerman
ID: 22992234
Cool.

Use:

CSVDE -i -f filename.csv

This should import the OU.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

807 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