export using ldifde and csvde

D

David

I am looking for a way to dump samaccountnames out of a specific OU
(ex STUDENTS in dc=my,dc=domain). I want one name per line in a flat
file. Does anybody know how to do this with either ldifde or csvde?
Any help would be much appreciated. Thanks in advance

David
 
B

bk

You are going to have to re-parse your file (i.e. FIND, or
FOR). One quicker, easier way is to just use ADUC, select
the OU, select columns view to include the pre-Win2000
login name, select - Export List... save as csv... then
you can sort/copy/print it in Excel.
 
C

Cary Shultz [A.D. MVP]

David,

Have you tried using the -l switch with ldifde and then indicating only the
attributes that you want?

For example, you could use the following at a command prompt: ldifde -f
c:\admininfo\ldf\students.ldf -s yourserver01.yourdomain.com -t 389 -d
"OU=Students,DC=yourdomain,DC=Com" -p Subtree -r "(objectClass=user)" -l
"DN,sAMAccountName"

The output would be a simply .ldf file located called 'students.ldf' located
in the c:\admininfo\ldf folder which would contain only two attributes:
their DN and sAMAccountname. I am usually in the habit of including the -s
switch command as well as the -t switch command ( the servername and the
port number ), but these are optional. The -d switch simply tells ldifde
where to look ( defaults to DC=yourdomain,DC-Com ) and the -r switch is the
filter. The -l switch tells ldifde to simply include the listed attributes
in the output. Shoot, my might even want to leave off the "DN" so that your
output file includes ONLY the sAMAccountName.

HTH,

Cary
 
C

Cary Shultz [A.D. MVP]

Small addendum:

Should have included the (objectCategory=person) in the filter. Simply
having (objectClass=user) will probably included a bunch of things that you
neither need nor want ( like computer accounts, etc. ). So, the command
would look like this:

C:\>ldifde -f useraccounts.ldf -s dc1.yourdomain.com -t 389 -d
"DC=yourdomain,DC=Com" -p subtree -r
"(&(objectClass=user)(objectCategory=person))" -l
"DN,sAMAccountName,....,telephoneNumber"

Cary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top