Importing Users


CSVDE is a command-line tool that imports or exports Active Directory objects from or to a comma-delimited text file (also known as a comma-separated value text file, or .csv file).
Comma-delimited files can be created, modified, and opened with tools as familiar as Notepad and Microsoft Office Excel.

Use the buttons below to navigate through the lesson

If you have user information in existing Excel or Microsoft Office Access databases, you will find that CSVDE is a powerful way to take advantage of that information to automate user account creation.

The basic syntax of the CSVDE command is:
csvde [-i] [-f Filename] [-k]
The -i parameter specifies import mode; without it, the default mode of CSVDE is export. The -f parameter identifies the file name to import from or export to.
The -k parameter is useful during import operations because it instructs CSVDE to ignore errors including Object Already Exists, Constraint Violation, and Attribute Or Value Already Exists.
The import file itself is a comma-delimited text file (.csv or .txt) in which the first line defines the imported attributes by their Lightweight Directory Access Protocol (LDAP) attribute names. Each object follows, one per line, and must contain exactly the attributes listed on the first line. Here’s a sample file:

This file saved as users.csv will be used to import the six users into Active Directory.

Select Start>command prompt. Type the command
Csvde -i -f i:\users.csv -k
And press Enter.
Command completed successfully.

The users have been added to Active Directory.


You can also use Ldifde to import or export Active Directory objects, including users.

The Lightweight Directory Access Protocol Data Interchange Format (LDIF) is a draft Internet standard for file format that can be used to perform batch operations against directories that conform to the LDAP standards.

LDIF supports both import and export operations as well as batch operations that modify objects in the directory. The LDIFDE command implements these batch operations by using LDIF files.

The LDIF file format consists of a block of lines that, together, constitute a single operation.

Multiple operations in a single file are separated by a blank line. Each line comprising an operation consists of an attribute name followed by a colon and the value of the attribute.

For example, suppose you wanted to import user objects for two sales representatives, named April Stewart and Tony Krijnen. The contents of the LDIF file would look similar to the following example:

This file saved as users.ldf will be used to import the two users into Active Directory.

Type the command
ldifde -i -f i:\users.ldf -k
And press Enter. Command completed successfully. The users have been added to Active Directory.