How to use Csvde to import contacts and user objects into Active Directory (327620)



The information in this article applies to:

  • Microsoft Exchange 2000 Server, when used with:
    • the operating system: Microsoft Windows 2000

This article was previously published under Q327620

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 "obj-class" that you must rename to "objectClass." You must also rename "Display Name" to "displayName."

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.

objectClassDNdisplayName
contactdistinguished name of user objectDisplay Name


Note that distinguished name of user object 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=OU name,DC=Domainname,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.

objectClassDNdisplayNamesAMAccountNameuserAccountControl
userdistinguished name of user objectNoMail UserNoMail User66048


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 "(null)"
Logging in as current user using SSPI
Importing directory from file "mailenabledcontactimport.csv"
Loading entries.
Add error on line 2: Already Exists
The server side error is "An attempt was made to add an object to the directory with a name that is already in use."
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 "(null)"
Logging in as current user using SSPI
Importing directory from file "mailenableduserimport1.csv"
Loading entries.
Add error on line 2: Constraint Violation The server side error is "A required attribute is missing."
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

REFERENCES

For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

233209 Windows 2000 contacts and users

304935 How to set Exchange Server 2000 and 2003 mailbox rights at the time of mailbox creation

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

324353 Users cannot access public folders or delegate mailboxes on a separate server

back to the top

Modification Type:MinorLast Reviewed:9/19/2005
Keywords:kbHOWTOmaster KB327620 kbAudITPRO