?
Solved

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

Posted on 2010-11-22
13
Medium Priority
?
967 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
13 Comments
 
LVL 71

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
 

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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 71

Assisted Solution

by:Chris Dent
Chris Dent earned 300 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 71

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 71

Assisted Solution

by:Chris Dent
Chris Dent earned 300 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 71

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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