How to use CSVDE to export users from Active Directory


It is a common problem if I deal with a project about how to export-import users from different domain to a new one. Kind of brain scratching dealing with ADMT so if the customer agrees we can create new users to our new Domain, with new password, with the legacy user’s attributes. First simple trick is to analyze what kind of User’s attributes are being used. First of all take a look to a common user (or 10) and note every attributes which are being used.

If you find them then let’s prepare the export command

csvde -f c:\temp\exportedusers.csv -u -p subtree -r "(&(objectCategory=person)(objectClass=User)(givenname=*))" -l "cn,givenName,samAccountName,telephoneNumber,description,mail,mobile,physicalDeliveryOfficeName,ObjectClass,displayName,SN"

So what does it do? csvde is our command -f is the file name –> c:\temp\exportedusers.csv is the file (CSV extension) -u is for the special characters (öüóőúáé etc) called Unicode, -p is the default SubTree meaning all Active Directory Information, -r and after all that strange characters are for filters on LDAP properties and the last -l means for listing only the following LDAP attr.

cn=Full Name

givenName=First Name

samAccountName=User ID




mobile=mobile telephone


ObjectClass=Will be User as already filtered after the “-r”

DisplayName=Full Name

SN=Last Name

After this export we will get a CSV file. I usually save as xlsx as we will not use the csvde import command to import this, we will go with a different way.

On the next Blog post I will show you a little Excel trick to create new AD Users with the exported attributes.


70 thoughts on “How to use CSVDE to export users from Active Directory

Leave a Reply

Your email address will not be published. Required fields are marked *