Going back to CSVDE School -Parameters, Switches you name it… We do Old Skool..

Before the joys of Export-CSV there used to be another way of dumping Active Directory data to CSV using again native tooling. In a recent project I have had to rediscover the old ways and go back to school to learn the required switches, which I am now going to share with you all.

Switch

Description

-a

UserDistinguishedName
Password. If you must use these switches, then treat -a and -b as
a pair. A likely scenario is that you are logged on as
non-administrator and wish to run CSVDE against your Active Directory.
As a non-administrator, you would get an error unless you employ these
switches to connect with the correct credentials

-b

UserDistinguishedName
Password. If you must use these switches, then treat -a and -b as
a pair. A likely scenario is that you are logged on as
non-administrator and wish to run CSVDE against your Active Directory.
As a non-administrator, you would get an error unless you employ these
switches to connect with the correct credentials

-c

String1 String2. This
switch replaces all olddomain names in String1 with newdomain names
String2. Could be used to change all dc=oldom distinguished name in the
export domain (String1) with dc=newdom of the import domain (String2).

-d

This is useful filter switch for
when you want to export from just one OU. Use the -d switch to set the
root directory for the export. For example, if you are only interested
in an OU called Newport type, CSVDE -f export.csv -d
“OU=mycompany,DC=domain,DC=com”.
Note, there are no spaces between domain,DC=com.

-f

filename is a mandatory switch
for both import and export. Simply specify the .csv file for transfer
data. It makes life easier if this file is in the same directory as you
issue the CSVDE command. Here is an export example CSVDE
-f export.csv

Path Sets the log file
directory. The point of a log file is that it’s permanent where as the
-v verbose mode is ephemeral. -j creates one or two log files. It
always creates a file called csv.log, additionally it creates csv.err if it encounters
any errors.

-j

Trap: As far as I can see
without the -j switch, CSVDE will not create a log file at all. I
mention this as other documentation suggests that you are just setting the
path, in my opinion, with -j you are creating the file as well as setting its
path.

-k

Useful for ignoring simple
errors: “Object already exists,” “Constraint violation,”
and “Attribute or value already exists.” I almost always use
this switch as part of the CSVDE import command

-l

LDAP Attributes. On
the one hand, I think of L for list, on the other hand I think of -l as a
column-wise filter. What this switch does is export only the LDAP
properties that you are interested in and ignores the rest of the attributes.
Example CSVDE -f export.csv -l “DN,
objectclass, objectcategory, givenName, sn”.
Note the position of speech marks and commas.

-m

Another column-wise
filter. Omits Active Directory properties such as the ObjectGUID, objectSID, pwdLastSet
and samAccountType
attributes.

I hope these switches help you, like they have helped me and credit to all the previous bloggers which enabled me to get this list together.