The following are some useful csvde queries that I’ve used with various customers. Depending on your requirements, they can be easily modified to suite your needs.
You may need to use the "-s" csvde option to point to an AD server. If you want to limit the search to a specific OU, you can use the "-d" switch. For example add this to the end of any command:
-d "ou=health,ou=na-organizations,dc=na,dc=com"
To dump all object classes from AD. Point to forest root. Great for detecting schema changes and associated dates:
csvde -f classes.txt -d cn=schema,cn=configuration,dc=root,dc=com -r (objectCategory=classSchema)
To dump all object class attributes from AD. Point to forest root:
csvde -f attributes.txt -d cn=schema,cn=configuration,dc=root,dc=com -r (objectCategory=attributeSchema)
To dump all contact objects:
csvde -f contacts.csv -p subtree -r "(objectClass=contact)" -l "givenName, sn, displayName,cn"
csvde -f contacts.csv -p subtree -r "(objectClass=contact)" -l "givenName, sn, displayName,cn"
To dump all user objects:
csvde -f users.csv -p subtree -r "(&(objectCategory=person)(objectClass=user))" -l "sAMAccountName"
To dump all users with ExtensionAttribute1=exception:
csvde -f usersEA1.csv -p subtree -r "(&(objectCategory=user)(extensionAttribute1=exception))"