Exporting Active Directory Users Into CSV

It took far too long to find this very very useful command online so I thought I’d repost to help others find it.
The below command exports as follows:
Connection to server: domain.local
Exporting attributes: whenChanged,whenCreated,cn,sAMAccountName,givenName,sn
From DN Root: DC=domain,DC=local
Into File: domain.local-users.csv
csvde -s domain.local -l "whenChanged,whenCreated,cn,sAMAccountName,givenName,sn" -d "DC=domain,DC=local" -f domain.local-users.csv

One thought on “Exporting Active Directory Users Into CSV

  1. great script.
    Thank you for sharing this with us.
    Though, In a quick rush, I tried using an automated solution named Lepide active directory query tool which is available free.
    However, I have bookmarked the resource for my further help.

Leave a Reply