CSVDE – Import User Accounts

Introduction to CSVDE Import

The purpose of this page is to show you how to bulk import user accounts into Active Directory.  Here are scenarios where CSVDE will save you work:

  • To create hundreds of new users in a Windows Server 2003 or 2000 domain.
  • To import hundreds of NT 4.0 users into a brand new Active Directory domain.
  • To migrate directory services from Exchange 5.5 into Active Directory.

Topics for CSVDE Import User Accounts


Export Examples

Why Begin with Export?

When you use CSVDE -i to import user accounts, you make changes that will be difficult to reverse.  For instance, you may import unsuitable usernames, but then you cannot find those users in Active Directory.  In frustration, you delete existing users as well as the imported test accounts.   In export mode, you can do no harm to Active Directory, also CSVDE -f filename.csv will help build up your understanding of the switches.

Import Examples

The secrets of successful importing are:

1) Practice with export first!  So that you learn the switches, and obtain the precise spelling of LDAP fields, for example sAMAccountName is correct, sAMAaccountNames has two mistakes and would cause the import to fail.

2) Create a good .CSV file.  Master the LDAP fields in the first row.

3) Use VBScript to enable accounts and set the password.  This overcomes the main limitation of CSVDE namely that you cannot import passwords, nor can you alter accounts in anyway.  See here for a VBScript to reset passwords.

Mastering bulk import will save you time when you need to create hundreds of user accounts.  CSVDE would be the method of choice if you have the users in a spreadsheet.

Guy Recommends:  SolarWinds’ Free Bulk Import ToolFree Download Solarwinds Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD’s attributes, click and import the users.

Optionally, you can provide the name of the OU where the new accounts will be born. Download your FREE bulk import tool.

If you need more comprehensive software, download a free trial of SAM (Server & Application Monitor)

Example 1: Importing data with -i -f filename

To import a file into Active Directory use the CSVDE -i  which tells it to import.  -f users.csv  is the filename.  So the complete command is CSVDE -i -f users.csv  Note the space between the command and each switch.  The first line, referred to as the header, should have a list of the field names. For example, DN, FirstName, Surname.

Preparation: Open the text file with the users, and add LDAP attributes to the top row.

Command: CSVDE -i -f usersi.csv

Example 2: Using the -k to force an import

Command: CSVDE -i -k -f usersi.csv

Example 3: A CSV file with the LDAP attributes in the top row.

Preparation: If you wish to use this example below, firstly copy and paste it into notepad.  Then change the attributes to match your circumstances.  For example, change WonderDom to your domain name, and change the OU=Worcester to OU=yourOU.

I suggest importing the file into Excel, making your changes, then exporting it as a .CSV file.

"CN=Peter Graham,OU=Worcester,DC=WonderDom",Peterg,Peterg@WonderDom.com,891-1239,Production,512,user
"CN=Janie Bourne,OU=Worcester,DC=WonderDom",Janieb,Janieb@WonderDom.com,891-1239,Production,512,user
"CN=Edgar Dunn,OU=Worcester,DC=WonderDom",Edgard,Edgard@WonderDom.com,891-1230,Production,512,user
"CN=Belinda Hart,OU=Worcester,DC=WonderDom",Belindah,Belindah@WonderDom.com,891-1231,Production,512,user
"CN=May Jamieson,OU=Worcester,DC=WonderDom",Mayj,Mayj@WonderDom.com,891-1232,Production,512,user
"CN=Leroy Ota,OU=Worcester,DC=WonderDom",Leroyo,Leroyo@WonderDom.com,891-1233,Production,512,user

Command CSVDE -i -k -f user3.csv

Recommended: Solarwinds’ Permissions Analyzer – Free Active Directory ToolFree Permissions Analyzer for Active Directory

I like thePermissions Analyzer because it enables me to see WHO has permissions to do WHAT at a glance.  When you launch this tool it analyzes a users effective NTFS permissions for a specific file or folder, and takes into account network share access, then displays the results in a nifty desktop dashboard!

Think of all the frustration that this free SolarWinds utility saves when you are troubleshooting authorization problems for user’s access to a resource.  Give this permissions monitor a try – it’s free!

Download SolarWinds’ Free Permissions Analyser – Active Directory Tool


  • Check that you understand LDAP attributes and syntax: DC=domain, DC=COM.
  • Make sure that Excel is not open at the .csv you are trying to create.
  • Take care with your Find and Replace.
  • Check out the Error Messages.
  • Use the log switch: -j C:\
  • Experiment with different syntax. Try a different output filename.
  • Contact Guy Thomas – see email address below.

See Also