segunda-feira, 13 de junho de 2011

Quick Recipe: Exporting Active Directory informatin using CSVDE


CSVDE is a very nice tool to export information from AD DS. It allows you to perform queries in the LDAP context and export the results into nice CSV files, much easier to parse with other language or with Excel (or other spreadsheet solution).

To see all options from CSVDE just type it in the Command Prompt or Power Shell (I prefer Power Shell console).

So let's go: how to export all Users from my Domain? With the command:
csvde -d "dc=example,dc=com" -f example-com.csv -r
"(&(objectclass=user)(objectcategory=person))" -l "DN"

To export the logins use the following command:
csvde -d "dc=example,dc=com" -f example-com.csv -r
"(&(objectclass=user)(objectcategory=person))" -l "userPrincipalName"

DN and userPrincipalName will be exported.

Command analysis:
  • -d option is where you want to look for your info, in the entire domain, one specific OU etc.
  • -f specifies the output file
  • -r is the advanced filter for LDAP search
  • -l is the fields limitation from the search, in this case I just want the DN's.
Further information:

Nenhum comentário:

Postar um comentário