Import/export objects via command line

To import and export Active Directory data from the command line you can use utility admimex.exe. The utility is located in the folder where Adaxes Administration console is installed which is C:\Program Files\Softerra\Adaxes 3\Administration Console by default.

Syntax

admimex.exe  [@argfile] [/?|h|help] [/v|version] [/i]
             [/d LDIF|DSML1|DSML2|CSV|TXT|HTML|EXCEL]
             /f filename [/s service] [/user user] [/pwd password]
             [/r baseDN] [/t filter] [/p BASE|ONE|SUB] [/a attrlist]
             [/lbs NONE|WIN|UNIX] [/page size] [/dh] [/di] [/dd]
             [/ds] [/cf fromDN] [/ct toDN] [/fs separator] [/vs separator]
             [/tq qualifier] [/sr number] [/el SINGLE|MULTI]
             [/ec TEXT|GENERAL] [/eh]

Parameters

/i
If specified, the import operation is performed. If not specified, the export operation is performed.

/d value
Specifies the format of the file to import from or export to. Possible values for data export are LDIF, DSML1, DSML2, CSV, TXT, HTML, EXCEL. Data can be imported in LDIF, DSML, and CSV formats only.

/f filename
Specifies the name of the file to import from or export to.

/s service
Specifies the Adaxes service host. If not provided, the default value localhost is used.

/user user
Specifies the user account used to perform the export or import operation.

/pwd password
Specifies the password of the user account used to perform the export or import operation.

/r baseDN
Specifies the object DN to start the export from.

/t filter
Specifies the LDAP search filter for exporting AD objects. Only the objects that match the specified filter will be exported. If the parameter is omitted, the default value (objectClass=)* is used.

/p value
Specifies the scope of objects to export. Available values are:

  • BASE – only the object specified by the /r parameter is exported.
  • ONE – export is only performed for the direct children of the object specified by the /r parameter.
  • SUB – export is performed for the object specified by the /r parameter and all of its descendants.

If the parameter is omitted, BASE is be used by default.

/a attrlist
Specifies a comma-separated list of AD object properties to export.

/lbs value
Specifies the way line breaks will be inserted in the result file. Possible values are:

  • NONE – no line breaks
  • WIN – (CR LF)
  • UNIX – (CR)

If the parameter is omitted, WIN is used by default.

/page size
Specifies the search page size for data export. The page size specifies the maximum number of records returned for each search request. If the parameter is omitted, the default value 500 is used.

/dh
Disables generation of the document header. The document header contains export date/time and information about the source, etc.

/di
Disables indenting in the exported document. The option can be used for DSML1, DSML2, and HTML formats.

/dd
Disables the transformation of property values into human-readable form, so all properties are exported as they are stored in Active Directory.

If the option is omitted, values of some properties will be converted into human-readable form. The option can be used for TXT, CSV, HTML and Excel formats.

/ds
Specifies that SAM-specific properties are not excluded during export or import.

/cf fromDN
Specifies the DN suffix to replace. If specified, the suffix of the imported or exported objects is replaced with the suffix specified in the /ct parameter. This can be done, for example, to import exported objects to another location.

/ct toDN
Specifies the suffix, with which an object DN part will be replaced. The value replaces the suffix of the imported or exported objects specified in the /cf parameter. This can be done, for example, to import exported objects to another location.

/fs separator
Specifies the delimiter used to separate columns in TEXT and CVS files. If the parameter is omitted, the default value ';' is used.

/vs separator
Specifies the delimiter used to separate property values in of multi-valued properties. If the parameter is omitted, the default value ',' is used.

/tq value
Specifies the text qualifier for TEXT and CSV files. Text qualifiers are used to identify the boundaries of strings. If a field separator character appears within the boundary, it won't be considered as a delimiter. If the parameter is omitted, the quotation mark (") is used as the default value.

/sr number
Specifies the row, starting from which TEXT or CSV file will be imported. If the parameter is omitted, the import starts from the first row. Specify the parameter, if your file contains a header.

/el value
Specifies the layout for EXCEL documents. Possible values are:

  • SINGLE – all objects are represented in a single table
  • MULTI – each object is represented in a separate table

If the parameter is omitted, the default value SINGLE is used.

/ec value
Specifies the cell format for EXCEL documents. Possible values are:

  • TEXT
  • GENERAL

If the parameter is set to GENERAL, Excel will auto-detect the cell format depending on the value of each particular cell. If the parameter is omitted, the default value TEXT is used.

/ue
If this parameter is specified, the 'Object already exists' error will be thrown if an imported object already exists in Active Directory. If the parameter is omitted, existing objects will be updated with the data from the CSV file.

/cd value
Specifies how DN suffixes are replaced in properties that refer to AD objects (DN syntax properties). This parameter is used only with /cf and /ct parameters. Possible values are:

  • NONE – do NOT replace DN suffixes in object properties.
  • EXISTING – replace only DNs that refer to the objects from the import file.
  • ALL (default) – replace all DNs.

/nco
If specified, all records will be imported in the order in which they appear in the import file. If not specified, the order will be changed if necessary (child objects will be imported after parent objects).

/pu
If specified, all object properties that refer to other objects (DN syntax properties) will be saved to the directory after all objects are imported. This is useful if a parent object contains a DN syntax property referring to a child object.

/eh
Forces to freeze the header in EXCEL documents keeping it in view while scrolling through the file.

Examples

Example 1 – Export a specific user account to an LDIF file

admimex.exe /d LDIF /f c:\file.ldif /r "CN=John Doe,CN=Users,DC=example,DC=com"

Example 2 – Export objects located in the Users container to an LDIF file

admimex.exe /d LDIF /f c:\file.ldif /p ONE /r "CN=Users,DC=example,DC=com"

Example 3 – Import data from a DSML file

admimex.exe /i /d DSML /f "c:\file.xml"

Example 4 – Export objects located in the Users container using the specified credentials

admimex.exe /d CSV /f c:\file.csv /r "CN=Users,DC=example,DC=com"
/user EXAMPLE\administrator /pwd secret /p SUB

Example 5 – Export objects located in the Users container using an ARG file

admimex.exe @"C:\Examples\argfile.txt"

File content example: /d LDIF /f c:\file.ldif /r "CN=Users,DC=example,DC=com" /p ONE

Example 6 – Export only inetOrgPerson objects from the Users container

admimex.exe /d LDIF /f c:\file.ldif /r "CN=Users,DC=example,DC=com" /p SUB
/t (objectClass=inetOrgPerson)

Example 7 – Import objects to the New Users container, if they were exported from the Users container

admimex.exe /i /d LDIF /f C:\file.ldif /cf "CN=Users,DC=example,DC=com"
/ct "CN=New Users,DC=example,DC=com"

Example 8 – Export only the Display Name and Telephone Number properties of AD objects

admimex.exe /d TXT /f C:\file.txt /r "CN=Users,DC=example,DC=com" /p ONE
/a displayName,telephoneNumber