CSVDE: How to Troubleshoot Import and Export
Troubleshooting CSVDE Import Operations
The most common problem when importing data using CSVDE into an LDAP repository (Active Directory, AD DS, AD LDS, ADAM, or others) are typos in the source file.
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.
Csvde does give indications of what is not acceptable in your .csv file for import operations.
For example:
- you cannot use Csvde to duplicate entries that are supposed to be unique in the database, such as sAMAccountName.
- if you have a user in your directory named Ben Smith, using a sAMAccountName of BSmith, you cannot later add an account for a user named Brian Smith using the same BSmith sAMAccountName.
If you try, you will see an error message similar to the following:
C:\Users\DAdmin>csvde -i -f importusers.csv
Connecting to "(null)"
Logging in as current user using SSPI Importing directory from file "importusers.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:\Users\DAdmin>csvde -i -f importusers.csv
Connecting to "(null)"
Logging in as current user using SSPI Importing directory from file "importusers.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.
Some specific items to check when troubleshooting CSVDE import operations include.
- Ensure your data import definition line is in the correct format and has the correct attribute naming. Computer Performance provides a nice short list of LDAP Properties for CSVDE and VBScript. If you need a more comprehensive list of attributes, you will likely have to navigate MSDN
- Ensure that the first line of an import file provides the LDAP object definitions in the order that you have the remaining pieces of information defined.
- Ensure that any piece of information that is omitted in an import file line is done so with two commas (or a blank spreadsheet cell, if you are viewing as a spreadsheet). sEE
- Remember that if you create a file with a spreadsheet application to save it in comma separated value (CSV) format. You might want to view files with a text editor before trying them to ensure there are no extraneous spaces and that all the appropriate commas are in place.
- Ensure that you have the file formatted properly. Any extraneous information or missed punctuation will cause the information import to fail.
- Be very careful of extraneous spaces, especially trailing spaces and the end of files or lines you intend to import. If you are using Notepad and having a difficult time viewing formatting, you might try another editor that has advanced capabilities, such as the free Notepad2 ( http://notepad2.com/) product. You can then use the View options to see Whitespace, Line Endings, Wrap Symbols, and so on that will help to diagnose that you have the appropriate input.
- Watch out for missing quotation marks. You must have double-quotation marks surrounding any entries that contain spaces. For example, if you are trying to import the name Jeff Hey in an organizational unit HQ in the Cpandl.com domain using the following LDAP object definition line:
DN,objectClass,sAMAccountName,givenName,sn,userPrincipalName
The Distinguished Name (DN) portion would be surrounded in quotation marks, as in:
"cn=Jeff Hey,ou=HQ,dc=cpandl,dc=com",user,JHey,Jeff,Hey,jeff.hey@cpandl.com
Also, if you are trying to place a comma within an entry, you can double quote it. Just realize that you only want to do that is really want you want to do. For example, if you want the displayName for Jeff Hey to be Hey,Jeff, then you would enter the following first line:
DN,objectClass,sAMAccountName,givenName,sn,displayName,userPrincipalName
Then, you would include a field for each value you wanted to define:
"cn=Jeff Hey,ou=HQ,dc=cpandl,dc=com",user,JHey,Jeff,Hey,"Hey,Jeff",jeff.hey@cpandl.com
Further, if you wanted to omit an entry that is defined, you must still represent that field if it is in the definition line. For example, say you use the same definition line as above:
DN,objectClass,sAMAccountName,givenName,sn,displayName,userPrincipalName
But you do not want to include a displayName for Jeff Hey. Then you would have the following line as an entry for Jeff Hey's account:
"cn=Jeff Hey,ou=HQ,dc=cpandl,dc=com",user,JHey,Jeff,Hey,,jeff.hey@cpandl.com
Effectively the two back-to-back commas are indicating that the displayName, while defined, should not be populated for this account.
Troubleshooting CSVDE Export Operations
The most common problem when exporting data using CSVDE is the export command itself. One thing to keep in mind about exporting is that in Windows Server 2003 R2 and its predecessors, you had to specify -e switch to export. Starting in Windows Server 2008 the -e switch was the default and in order to import, you would have to specify the -i switch.
Conclusion
This article explained how to use the CSVDE command and to troubleshoot it.Hope this article is useful for you.Leave your feedback in comments session.
Glossary
Item | Description |
AD LDS | Active Directory Lightweight Directory Services |
ADAM | Active Directory Application Mode |
AD DS | Active Directory Domain Services |
CSVDE |
Comma Separated Value Data Exchange |
CSV | Comma Separated Value |
LDAP | Lightweight Directory Access Protocol |
ADSI | Active Directory Service Interfaces |
SSPI | Security Support Provider Interface |
Related information
- Troubleshooting CSVDE Error Messages
- Comma Separated Value Directory Exchange (CSVDE)
- How to use Csvde to import contacts and user objects into Active Directory
- Troubleshooting CSVDE import and export
- How to use CSVDE.EXE to back up and restore connection agreements
- Step-by-Step Guide to Bulk Import and Export to Active Directory
- How to set a user's password with LDIFDE
- CSVDE -i Bulk Import
- LDAP Properties for CSVDE and VBScript
If you need specific assistance formatting CSVDE files or have specific questions, search the Directory Services Forum ( http://social.technet.microsoft.com/Forums/en-US/winserverDS/threads) and if you are unable to find the answer you need, consider posting a new question there.