Export information from Active Directory to a CSV file

I wanted to reboot all PC’s in a particular OU of our Active Directory structure.  I found csvde which is a tool for exporting and importing data to and from Active Directory.
Once I got all of the computer names out and into a csv file I used the shutdown -i tool to past the computer names into and let it remotely reboot them.

Here are some sample csvde scripts for exporting various pieces of information:

Export everything (computers, users, groups etc.  This could be a lot of records depending on your Active Directory so be careful.):

CSVDE -f exportFilename.csv

Export computer accounts from specified OU with only a few columns (just does dn, cn and name columns):

csvde -f ComputerNamesExport.csv -d “OU=OUName,DC=domain,DC=org” -r “(objectClass=computer)” -l “dn,cn,name”

- You can leave off the -l “dn,cn,name” and you’ll get all columns.

Export user accounts from whole domain with only the specified columns:

csvde -f \\server1\common\it\UserNamesExport.csv -d “DC=CBCO,DC=org” -r “(objectCategory=person)” -l “dn,cn,displayName,description,title,department,physicalDeliveryOfficeName,company”

- You can leave off -l and the rest to get all columns.

2 Comments

gurbMarch 16th, 2012 at 5:47 pm

Hi Thanks for this posting.

Your post helped me to get started with csvde. I am still not there where I want to be and I would truly appreciate if you could help me a bit more. Here is my setup.

AD server: stu.mysite.ca
OU: students, staff, etc.
Groups: under students ou:
STU-BIZ-ALL
STU-COMP-ALL
and so on..

I would like to extract the student names and email address from STU-COMP-ALL group

Not sure how to do this.

Regards,

Gurb

muja1913@gmail.comMay 7th, 2012 at 7:40 am

hi
can you please tel me how to import the users from CSV File

Leave a comment

Your comment