Imports and exports data from Active Directory

I use this command to get all users information from my domain (spsb.net.my) in one of the OU (head quarters). The output file would be user-hq-ou.csv.

csvde -f user-hq-ou.csv -d "OU=head quarters,DC=spsb,DC=net,DC=my" -r (objectClass=user)


The full explanation is as follows:

Csvde

Imports and exports data from Active Directory using files that store data in the comma-separated value (CSV) format. You can also support batch operations based on the CSV file format standard.

Syntax

csvde [-i] [-f FileName] [-s ServerName] [-c String1 String2] [-v] [-j Path] [-t PortNumber] [-d BaseDN] [-r LDAPFilter] [-p Scope] [-l LDAPAttributeList] [-o LDAPAttributeList] [-g] [-m] [-n] [-k] [-a UserDistinguishedName Password] [-b UserName Domain Password]

Parameters

-i
Specifies import mode. If not specified, the default mode is export.
-f FileName
Identifies the import or export file name.
-s ServerName
Specifies the domain controller to perform the import or export operation.
-c String1 String2
Replaces all occurrences of String1 with String2. This is generally used when importing data from one domain to another and the distinguished name of the export domain (String1) needs to be replaced with that of the import domain (String2).
-v
Sets verbose mode.
-j Path
Sets the log file location. The default is the current path.
-t PortNumber
Specifies an LDAP port number. The default LDAP port is 389. The global catalog port is 3268.
-d BaseDN
Sets the distinguished name of the search base for data export.
-r LDAPFilter
Creates an LDAP search filter for data export.
-p Scope
Sets the search scope. Search scope options are Base, OneLevel, or SubTree.
-l LDAPAttributeList
Sets the list of attributes to return in the results of an export query. If this parameter is omitted, all attributes are returned.
-o LDAPAttributeList
Sets the list of attributes to omit from the results of an export query. This is typically used when exporting objects from Active Directory and then importing them into another LDAP-compliant directory. If attributes are not supported by another directory, you can omit the attributes from the result set using this option.
-g
Omits paged searches.
-m
Omit attributes that only apply to Active Directory objects such as the ObjectGUID, objectSID, pwdLastSet and samAccountType attributes.
-n
Omits export of binary values.
-k
Ignores errors during the import operation and continues processing. The following is a complete list of ignored errors: "Object already exists," "Constraint violation," and "Attribute or value already exists."
-a UserDistinguishedName Password
Sets the command to run using the supplied UserDistinguishedName and Password. By default, the command runs using the credentials of the user currently logged on to the network.
-b UserName Domain Password
Sets the command to run as Username Domain Password. By default, the command will run using the credentials of the user currently logged on to the network.
-?
Displays the command menu.

Remarks

  • Applications such as Microsoft Excel are capable of reading and saving data in the CSV format. In addition, the Microsoft Exchange Server administration tools are also capable of importing and exporting data using the CSV format, as are many other non-Microsoft tools.

    The CSV format consists of one or more lines of data, with each value separated by a comma. The first line (sometimes referred to as the header) of the CSV file must contain the names of each attribute in the same order as the data in any line following the first line. For example:

    CN,FirstName,SurName,Description

    FirstUserLogonName,1stUserFirstName,1stUserSurname,Manager

    SecondUserLogonName,2ndUserFirstName,2ndUserSurname,President

  • You can use csvde -r to create an LDAP search filter for data export. For example, the following filter exports all users with a particular surname: csvde -r (and(objectClass=User)(sn=Surname))

Comments

Popular posts from this blog

Forgot EVA Command View admin userid/password

Manage wtmp Log Size In Aix

Network Connections Type