Logon Scripts

Guy recommends :
Free Solarwinds
VM Console

Solarwinds VM Console Free Download

Find out which of your VMs are a waste of space and which VMs need more resources.


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 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.

There are also two bonus tools in the free download, and all 3 have been approved by Microsoft:

  1. Bulk-import new users into Active Directory.
  2. Seek and zap unwanted user accounts.
  3. Find inactive computers.

Download your FREE bulk import tool.

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.

dn,sAMAccountName,userPrincipalName,telephoneNumber,department,userAccountControl,objectClass
"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

Troubleshooting

  • 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

 *


Custom Search

Guy Recommends: WMI Monitor and It's Free!Solarwinds WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.

Fortunately, Solarwinds have created the Free WMI Monitor so that you can actually see and understand these gems of performance information.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

 

Home Copyright © 1999-2012 Computer Performance LTD All rights reserved

Please report a broken link, or an error.

If you like this page then please share it with your friends

 


Download your eBook:  How to use CSVDE commands - only $6.25

CSVDESave hours of frustration and buy Guy's eBook.  The extra features include: detailed instructions on how to import and export user accounts, ten new pages of worked CSVDE examples.

You get a printer friendly version with copy enabled, and no expiry date.