Microsoft KB Archive/327620

= How to use Csvde to import contacts and user objects into Active Directory =

Article ID: 327620

Article Last Modified on 10/28/2006

-

APPLIES TO


 * Microsoft Exchange 2000 Server Standard Edition, when used with:
 * Microsoft Windows 2000 Standard Edition

-



This article was previously published under Q327620



IN THIS TASK

 * SUMMARY
 * Windows 2000 contact with no e-mail address
 * Windows 2000 user, no mailbox or e-mail address
 * Troubleshooting
 * References



SUMMARY
This step-by-step article describes how to use the Csvde.exe utility to create contacts and user accounts in Active Directory. You may have to use this method in some scenarios, for example, when administrators want to export custom recipients from Microsoft Exchange Server 5.5 and import them into Active Directory as Microsoft Windows contacts.

Csvde.exe is a Microsoft Windows 2000 command-line utility that is located in the SystemRoot\System32 folder after you install Windows 2000. Csvde.exe is similar to Ldifde.exe, but it extracts information in a comma-separated value (CSV) format. You can use Csvde to import and export Active Directory data that uses the comma-separated value format. Use a spreadsheet program such as Microsoft Excel to open this .csv file and view the header and value information. See Microsoft Excel Help for information about functions such as Concatenate that can simplify the process of building a .csv file.

Note Although Csvde is similar to Ldifde, Csvde has a significant limitation: it can only import and export Active Directory data by using a comma-separated format (.csv). Microsoft recommends that you use the Ldifde utility for Modify or Delete operations. Additionally, the distinguished name (also known as DN) of the item that you are trying to import must be in the first column of the .csv file or the import will not work.

The source .csv file can come from an Exchange Server directory export. However, because of the difference in attribute mappings between the Exchange Server directory and Active Directory, you must make some modifications to the .csv file. For example, a directory export from Exchange Server has a column that is named &quot;obj-class&quot; that you must rename to &quot;objectClass.&quot; You must also rename &quot;Display Name&quot; to &quot;displayName.&quot;

For more information about attribute mappings, click the following article number to view the article in the Microsoft Knowledge Base:

281563 Exchange Server 5.5 to Exchange 2000 attribute mappings for the Migration Wizard

Use the following syntax to run the tool from a command prompt:

csvde -i -f c:\filename.csv

The minimum required attributes are listed in this article for each type of object that you may want to create, and sample .csv file headers are provided. Note that the minimum required attributes for one organization may not meet usage requirements for another organization. Use ADSI Edit or Ldp.exe to view the attributes for existing users and to verify the attributes that you may need or want for your scenario.

Warning If you use the ADSI Edit snap-in, the LDP utility, or any other LDAP version 3 client, and you incorrectly modify the attributes of Active Directory objects, you can cause serious problems. These problems may require you to reinstall Microsoft Windows 2000 Server, Microsoft Windows Server 2003, Microsoft Exchange 2000 Server, Microsoft Exchange Server 2003, or both Windows and Exchange. Microsoft cannot guarantee that problems that occur if you incorrectly modify Active Directory object attributes can be solved. Modify these attributes at your own risk.

back to the top

Windows 2000 contact with no e-mail address
The list in this section describes the minimum required attributes for a Windows 2000 contact with no e-mail address. You may require more attributes to fit your needs. For example, you can easily add the telephoneNumber attribute to the .csv file.


 * objectClass. This attribute specifies what type of object to create.
 * DN (distinguished name). This attribute specifies the distinguished name of the new user object.
 * displayName. The displayName attribute contains the display name of the object as it appears in the Global Address List and any other address lists that the object is a member of.

These required attributes must be column headers in your .csv file as shown in the following example.

Note that  in this table includes the display name of the object being created plus the distinguished name of the organizational unit (OU) where this object is to be created.

For example, to create a contact named MailDisabledContact in an organizational unit, the value would look similar to the following value:

cn=MailDisabledContact,OU= ,DC= ,DC=com

This is also true for all other imports that are described in the rest of this article.

back to the top

Windows 2000 user, no mailbox or e-mail address
The list in this section describes the minimum required attributes for a Windows 2000 user with no mailbox or e-mail address.
 * objectClass. The objectClass attribute specifies what type of object is created.
 * DN (distinguished name). This attribute specifies the distinguished name of the new user object.
 * displayName. The displayName attribute contains the display name of the object as it appears in the Global Address List and in any other address lists that the object is a member of.
 * sAMAccountName. This attribute maps to Pre Windows 2000 Logon Name in the user interface, and it is typically the same as the User logon name.
 * userAccountControl. Set the value of this attribute to 512.

These required attributes must be column headers in your .csv file as they appear in the following example.

back to the top

Troubleshooting
Generally, the Csvde utility gives clear indications of what is not acceptable in your .csv file. For example, you cannot use Csvde to duplicate certain attributes if those attributes already exist in Active Directory. If you try to do so, you receive the following message:

C:\WINNT\system32>csvde -i -f mailenabledcontactimport.csv

Connecting to &quot;(null)&quot;

Logging in as current user using SSPI

Importing directory from file &quot;mailenabledcontactimport.csv&quot;

Loading entries.

Add error on line 2: Already Exists

The server side error is &quot;An attempt was made to add an object to the directory with a name that is already in use.&quot;

0 entries modified successfully.

An error has occurred in the program.

If a required attribute is missing from your .csv file, you receive the following message:

C:\csvde>csvde -i -f mailenableduserimport1.csv

Connecting to &quot;(null)&quot;

Logging in as current user using SSPI

Importing directory from file &quot;mailenableduserimport1.csv&quot;

Loading entries.

Add error on line 2: Constraint Violation The server side error is &quot;A required attribute is missing.&quot;

0 entries modified successfully.

An error has occurred in the program.

Csvde does not log events to the Application event log. To troubleshoot Csvde you must view the command line output and use LDP or ADSI Edit to compare your file with the attributes of existing user objects. Do not modify objects in Active Directory without first testing the process extensively in a lab environment.

back to the top

