I am really struggling to create the query that will export the following: Account FirstName LastName the OU that the user resides in
Ideally I would like it as a CSV. I do not have access to the domain controller, but can run DSQUERY/DSGET/etc. from my pc.
dsquery works but the conversion to CSV by splitting on one or more spaces (\s+ ) is tenuous. Any attribute value with embedded spaces is going to shift the remaining values to the right. Also, by default dsquery will stop after outputting 100 objects; "-limit 0" will output all results.
The correct way to do this via command line is using csvde:
The obligatory PowerShell method is:
Depending on your tools, you can do
That'll create a space-separated list of account name, firstname, lastname, and location.
Converting it into a true csv takes a bit more work.
Which will get you output like