So I'm writing a batch file that will be run by a scheduled task. This file executes a DSQuery for certain attributes of users in AD.
Here's my query:
dsquery user ou=org_unit,dc=company,dc=local -name * -limit 0 | dsget user -dn -email -tel >a.txt
So my question is how can I separate the output by commas? It shows in the text file in nice columns, but it's going to a place to be parsed out by something else for input into a database, and the parsing rules rely on commas.
I need to turn this:
CN=USER NAME,OU=ORG_UNIT,OU=ANOTHER_ORG_UNIT,DC=DOMAINROOT,DC=LOCAL (111)111-1111 [email protected]
Into this:
CN=USER NAME,OU=ORG_UNIT,OU=ANOTHER_ORG_UNIT,DC=DOMAINROOT,DC=LOCAL, (111)111-1111, [email protected]
So how can I edit my query to make it output what I need as shown? Is there something else I can run that'll do it for me?
Never mind. Figured out a CSVDE query to run it.
Returns what I need, in the format I need.