csvde is a command-line tool in Windows that is used to import or export Active Directory data from or to a comma-separated values (CSV) file. Primarily, it’s used for batch operations like creating or modifying multiple user accounts, managing group memberships, or exporting Active Directory entries for analysis. This tool is indispensable in large organizations for routine directory services tasks and migrations.


The basic syntax for using csvde is as follows:

csvde [options]

Where [options] can be a combination of various flags that define the operation’s specifics, including data source, destination, and the type of operation (import or export).


  • -i: Specifies the import mode. If not present, the default operation is export.
  • -f <FileName>: Designates the file name to import from or export to.
  • -s <ServerName>: Indicates the server to bind to. If omitted, csvde binds to the object source on the default domain controller.
  • -c <FromDN> <ToDN>: Replaces all occurrences of FromDN to ToDN in the export file. Useful for modifying paths when moving objects between domains.
  • -v: Enables verbose mode, providing more detailed output about the operation’s progress and errors.
  • -d <BaseDN>: Specifies the root of the LDAP search (base DN). Used to limit the scope of an export or import.
  • -r <LDAPFilter>: Applies an LDAP search filter to refine export results or to locate objects for import.
  • -p <Scope>: Sets the search scope. It can be “base”, “onelevel”, or “subtree”.
  • -j <LogPath>: Specifies the path where log files will be stored.
  • -t <PortNumber>: Specifies the Lightweight Directory Access Protocol (LDAP) port number to connect to.
  • -o <AttributeList>: List of attributes to omit during an export.
  • -m: Exports only minimal attributes necessary for importing data.
  • -n: Do not export binary values.


  1. Exporting all users from an Active Directory to a CSV file:
    csvde -f output.csv -r "(objectClass=user)"
  2. Importing users from a CSV file into Active Directory:
    csvde -i -f newusers.csv
  3. Exporting with custom attributes omitted and using verbose mode:
    csvde -f output.csv -r "(objectClass=user)" -o "userPassword,lastLogon" -v

Common Issues

  • Access Denied: If you encounter permissions issues, ensure you are running csvde with administrative privileges or with an account that has the necessary rights.
  • Syntax Errors in the CSV: When importing, ensure that your CSV file syntax matches the expected format, particularly concerning DN (Distinguished Name).
  • Missing Attributes: Some attributes may be required for certain operations and must be included in your CSV file.


Combine csvde with PowerShell scripts or batch files to automate common tasks, such as user onboarding. Here’s an example integrating csvde into a PowerShell script that checks for a CSV file and imports users:

if (Test-Path -Path "newusers.csv") {
    csvde -i -f newusers.csv
} else {
    Write-Output "User data file not found."
  • ldifde: Imports and exports data from/to Active Directory using LDAP Data Interchange Format (LDIF). Useful when more detailed object manipulation is needed.
  • dsquery, dsadd, dsmod – Tools for querying, adding, and modifying objects in Active Directory.

For more details and advanced usage, you can refer to the Microsoft official documentation on Csvde.