Latest Post

Automating Active Directory user account creations with csvde – ldifde

[00:03] Now, we are…
Automating Active Directory user account creations with csvde ldifde | IADDSWSE
Create .ldf and .csv files.

In the previous examples, we created user accounts and other AD objects by using built-in GUI tools of Windows Server.
These GUI help you with many benefits:
Visually observe for easier understand about meaning of options, features with the help of icons, hints, relationship checking, interactive with other.
It helps to choose value(s) for options with drop-down boxes, radio buttons,…

However, with these GUI tools, (in scope of this video) you can’t:
View attributes of 50, 100, 1000 users at the same time. With Active Directory Users and Computers GUI, you only can view entire attributes of 1 object per time.
Fusion tasking, with CLI tools, you can get the results from a command then pass them to other commands via pipeline operator "".
Example, by the end of Working with Active Directory Objects video, we used both "dsquery" and "dsget" commands together to get a granular view in details about users with specific attributes.
Now, we are using "csvde" and "ldifde" CLI tool to deal with user objects in Active Directory.
"ldifde" and "csvde" need script files with .ldf, .csv extension, respectly to store commands.
First, let’s create it.

The default behavior of "csvde" is export, so you only need to specify output’s results file name "SnoOpy.com.csv", for example, this is a meaningful name aim to represent this file itself contains all objects of SnoOpy.com domain.
.csv file with this meaningful name represents: domain name "SnoOpy.com", OU "IT", Fullname "DuongMinhThang".
We are creating the user "DuongMinhThang" with these attributes.
To learn more about:
LDAP attributes: bit.ly/LDAP-Attributes
csvde tool: bit.ly/csvde-csv
csvde is a simple, robust tool, but it lack of these abilities: "set a user password", "modify existing objects"
while ldifde can.
First, let’s…
Export and Import Users with Comma Separated Value Directory Exchange (CSVDE).

[02:19] There are all objects in "SnoOpy.com" domain.
Automating Active Directory user account creations with csvde ldifde | IADDSWSE
.ldf file with this meaningful name represents: domain name "SnoOpy.com", OU "IT", Fullname "Lucy" and "Linus".
We are creating users "Lucy" and "Linus" with these attributes.
To learn more about:
LDAP attributes: bit.ly/LDAP-Attributes
ldifde tool: bit.ly/ldifde-ldf

We will only export objects, which live in OU "IT" of "SnoOpy.com" domain by using the -d switch. The output file is "SnoOpy.com.OU=IT.csv".
This output file locates at the current working directory of the PowerShell prompt.
In this case, this is "Z:" disk, which were mapped from a share folder from the host machine.

[03:56] There are exported objects from OU "IT".
Automating Active Directory user account creations with csvde ldifde | IADDSWSE

Instead of you export all objects in a specific area; we can filter them to get only necessary objects by using csvde with -r objectClass=user
(only export objects whose class is "user" class).

[04:45] Let create a computer object in this OU to apply this filter.
Automating Active Directory user account creations with csvde ldifde | IADDSWSE

"user" class were specified with "-r objectClass=user" contains: users, inetOrgPersons and computers.
Thus, all objects in this OU match the criterion and will be exported, included a computer which we just created.

Now, let’s export only users in this OU with "-r objectCategory=person".
"person" category includes: contacts, inetOrgPersons, organizationalPersons, persons and users.
Thus, this computer object will not be exported.

[06:21] "objectCategory=person", not "objectClass=person" !
Automating Active Directory user account creations with csvde ldifde | IADDSWSE

Now, let’s export user whose "givenName" is "DuongMinhThang" in OU "IT".
"givenName" meaningful name, this is an LDAP attribute.
To learn more, go to:
http://bit.ly/LDAP-Attributes

In previous output files, we were realized that too many attributes "columns" were shown, while we only need to examine the "Distinguished Name (DN)" of these objects.
Let’s use csvde with "-l DN" to get the specific attribute "columns".
This is time to show the import function of csvde, with "-i" (import) and "-f" switches to specify, which csvde scripts file will be imported.

This csvde script file contains the definitions about user creation of "DuongMinhThang" in OU "IT".

[10:14] Now, we are…
Automating Active Directory user account creations with csvde ldifde | IADDSWSE
"user" was imported !

[10:22] Now, we are using ldifde tool to import users’ definitions from this .ldf file.
Automating Active Directory user account creations with csvde ldifde | IADDSWSE
Import Users with Lightweight Directory Interchange Format Data Exchange (LDIFDE).
ldifde can add, modify, delete AD objects.
Thus, you must specify actions per user’s definition.
In this case, this is "add" action.

[10:46] Users "Lucy", "Linus" were imported.
Automating Active Directory user account creations with csvde ldifde | IADDSWSE

AWESOME Medleys of SnoOpy: