Solved

What is the correct syntax to use for CSVDE to get the desired output

Posted on 2010-11-22
13
951 Views
Last Modified: 2012-05-10
How can I export data from large A D tree into a csv file. The OU that I need exported is PHD\Users and Groups\EMEA\United Kingdom\London The Domain is Called Global.com I need logonname, homedrive and home drive path. I know that I can get the data by using the csvde command and output to a csv file
0
Comment
Question by:EMEA iOps
  • 7
  • 5
13 Comments
 
LVL 70

Expert Comment

by:Chris Dent
ID: 34187552

Hello there,
csvde -r "(&(objectClass=users)(objectCategory=person))" -d "OU=London,OU=United Kingdom,OU=EMEA,OU=Users and Groups,OU=PHD,DC=global,DC=com" -l "sAMAccountName,homeDrive,homeDirectory" -f YourFile.csv

Open in new window

HTH

Chris
0
 
LVL 1

Expert Comment

by:amieldar
ID: 34187760
0
 

Author Comment

by:EMEA iOps
ID: 34187799
Hi Chris, I eneterd your suggested string, however it is not producing the desired output as I get after typing the command: Connecting to "(null)" login in as current user (I've got admin rights) using SSPI exporting directory to myfile.csv Searching for entries... Writing out entries No entries found The command has completed successfully. There are lots of objects in the container
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 70

Assisted Solution

by:Chris Dent
Chris Dent earned 75 total points
ID: 34187821

It's likely this path is not correct:

"OU=London,OU=United Kingdom,OU=EMEA,OU=Users and Groups,OU=PHD,DC=global,DC=com"

CSVDE doesn't validate it, if the path is not correct it will simply say it found nothing.

With that in mind, the path above translates to:

global.com/PHD/Users and Groups/EMEA/United Kingdom/London

Is that correct?

If unsure, pop open ADSIEdit, browse to the folder you want, open Properties and look at the DistinguishedName property, that's the value we must use.

Chris
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 34187840

Incidentally, if you have a lot of tasks like this to do, PowerShell with Quests AD CmdLets would simplify the interface for you (it will tell you if the path is wrong with "A referral was returned from the server").

Chris
0
 

Author Comment

by:EMEA iOps
ID: 34187871
Hi Chris,
Thanks for your answer the path is right the Canonical name of object is:
global.com/PHD/Users and Groups/EMEA/United Kingdom/London
Any ideas?
0
 
LVL 70

Assisted Solution

by:Chris Dent
Chris Dent earned 75 total points
ID: 34187936

Hmm well that's helpful of it. That should work.

-r is the filter and tells it you want user accounts (drops contacts and computers, caught by either condition on its own).
-d is the Search Root, and should work with what we have above
-l is the list of attributes (but we're not getting that far)

Lets drop the filter for now, and lets move up a level in the structure:
csvde -d "OU=United Kingdom,OU=EMEA,OU=Users and Groups,OU=PHD,DC=global,DC=com" -l "sAMAccountName,homeDrive,homeDirectory" -f YourFile.csv

Open in new window

Chris
0
 

Accepted Solution

by:
EMEA iOps earned 0 total points
ID: 34188052
Excellent the above syntax produced the desired output. Thanks for your help
0
 

Author Comment

by:EMEA iOps
ID: 34206891
I do also need to get their primary SMTP email address. What would be the sintax for it?
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 34206921

You just need the mail field, that holds the primary address.
csvde -d "OU=United Kingdom,OU=EMEA,OU=Users and Groups,OU=PHD,DC=global,DC=com" -l "sAMAccountName,homeDrive,homeDirectory,mail" -f YourFile.csv

Open in new window

Chris
0
 

Author Comment

by:EMEA iOps
ID: 34206947
Chris, you're a star mate.
0
 

Author Closing Comment

by:EMEA iOps
ID: 34221174
Thanks for your comments
0
 

Author Comment

by:EMEA iOps
ID: 34293418
Hi I have got a file exported, now I need to import the data once the home directory path has been updated. Can anyone help with the syntax: csvde -i -f filename.csv
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 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