Adaxes HelpShow AllHide All

Command Line Import and Export

Sometimes it may be necessary to export or import Active Directory data in the unattended mode. For example, you may want to set up a daily backup of your Active Directory data, or to make an LDIF import a part of your custom deployment scenario. For this purpose, admimex.exe tool can be used.

admimex.exe is a command line tool installed with Softerra Adaxes Administration Console that allows importing and exporting Active Directory data without running the Administration Console. All parameters are entered via the command line and the tool is run in the unattended mode.

[Tip]Tip
By default, admimex.exe is located in the C:\Program Files\Softerra\Adaxes 3\Administration Console folder.

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][/ue] [/cf fromDN] [/ct toDN] [/cd NONE|EXISTING|ALL] [/nco][/pu] [/fs separator] [/vs separator] [/tq qualifier] [/sr number] [/el SINGLE|MULTI] [/ec TEXT|GENERAL] [/eh]

Parameters:

/i

Specifies that 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 are:

  • LDIF
  • DSML1
  • DSML2
  • CSV
  • TXT
  • HTML
  • EXCEL
[Note]Note
Softerra Adaxes allows exporting directory data in all these formats, however, import is only available in LDIF, DSML, and CSV formats.
Learn more about these file formats.

/f filename

Specifies the name of the file to import from or export to.

/s service

Specifies the host of the target Adaxes service. 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 correspond to the specified filter will be exported. If this parameter is omitted, the default value is (objectClass=*).

/p value

Specifies the scope for exporting AD objects. Available values are:

  • BASE - export is only performed for the object specified by the /r parameter.
  • 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 children direct and indirect.

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

/a attrlist

Specifies a comma-separated list of AD object properties that will be exported.

/lbs value

Specifies the way line breaks will be inserted in the result file while exporting the directory data. Possible values are:

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

If this parameter is omitted, WIN will be used by default.

/page size

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

/dh

Disables generating of an extra header while saving results of the export operation. The extra header contains export date and time and information on where the data were exported from.

/di

Disables line indenting while generating results of the export operation. This option is applicable to DSML1, DSML2, and HTML. If this option is enabled, the resulting file is easier to read, while the deactivation of this option makes the file smaller in size.

/dd

Specifying this option disables the transformation of property values into human-readable format, so all properties are exported as they are stored in the Active Directory. For example, despite 'objectSid' is a binary property, Softerra Adaxes displays it in the SDDL form that allows displaying a security descriptor as a text string.

If this option is omitted, Softerra Adaxes will transform values of some properties into human-readable format. This parameter is applicable to TXT, CSV, HTML and Excel formats only.

[Note]Note
While exporting files without this parameter specified, such files might not be imported back into the directory since not all properties can be transformed back from human-readable representation.

/ds

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

/ue

Specifies that if an imported object already exists in Active Directory, it will be updated instead of throwing the 'Object already exists' error.

/cf fromDN

Specifies the suffix of an object DN 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. This 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.

/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 objects from the import file.
  • ALL (default) - replace all DNs.

/nco

If this parameter is specified, all records will be imported in the order in which they appear in the import file. If this parameter is not specified, the order will be corrected if it is necessary (child objects will be imported after parent objects).

/pu

If this parameter is specified, all object properties that refer to other objects are saved to the directory after all records are imported. This is useful if a parent object contains a DN syntax property referring to a child object.

/fs separator

Specifies the field separator used when importing/exporting TEXT and CVS files. Field separators are used to separate columns in the export or import file. If this parameter is omitted, the default value ';' will be used.

/vs separator

Specifies the property value separator used when importing/exporting TEXT and CVS files. Value separators are used to separate values of multi-valued properties in the export or import file. If this parameter is omitted, the default value ',' will be used.

/tq value

Specifies the text qualifiers used when importing/exporting TEXT and CSV files. Text qualifiers are used to identify the boundary of the text value. If a field separator character appears within this boundary, it won't be considered as a delimiter. If this 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 this parameter is omitted, the import starts from the first row. It is necessary to specify this parameter, if you file contains a header, as headers must not be imported.

/el value

Specifies the EXCEL file type layout. Possible values are:

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

If this parameter is omitted, the default value SINGLE will be used.

/ec value

Specifies the cell format for the EXCEL files. Possible values are:

  • TEXT
  • GENERAL

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

/eh

Forces to freeze the header of the EXCEL document keeping it in view while scrolling through the file.

Examples:

Example 1: Exporting a single user to the LDIF format

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

Example 2: Exporting 'Users' subtree to the LDIF format

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

Example 3: Importing data from a DSML file

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

Example 4: Exporting 'Users' subtree 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: Exporting 'Users' subtree using the ARG file

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

The ARG file contents:

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

Example 6: Exporting only inetOrgPerson objects from the 'Users' subtree

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

Example 7: Importing data to the 'New Users' container, though it was exported from the 'Users' container

[Note]Note
To import data to the location that differs from thier original location, you need to replace the suffix of DN of the objects being imported.

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: Exporting 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

See Also