Previous Page
Next Page

Output Information

By default, this script would not have any output information. However, to illustrate that the script is actually doing something, I implemented a simple WScript.Echo command to echo out the name of the container that was created. Because the OU to be created is held in the variable named oOUname, it was a simple proposition to echo out the contents of the variable, as illustrated in the following code snippetthe problem is the line of code could "lie" to you. If an error occurred, it would still say the OU was created.

WScript.Echo("OU " & oOUname & " was created")

To forestall this inexactitude, check the err object. If there are no errors, print out the line. If, however, an error occurs, then trap the message. The error line Err.number = "-2147019886" was developed by printing out the error numbers. When it was noticed that -2147019886 always appeared when a duplicate object existed, it was trivial to report this information. This is seen below:

If Err.number = 0 Then
WScript.Echo(strOUname & " was created")
Else If Err.number = "-2147019886" Then
WScript.Echo strOUname & " already exists"
Else
WScript.Echo " error on the play " & Err.Number
End If
End If

Quick Check

Q.

What is the process of connecting to Active Directory called?

A.

The process of connecting to Active Directory is called binding.

Q.

When specifying the target of an ADSI operation, what is the target called?

A.

The target of the ADSI operation is called the ADsPath.

Q.

An LDAP name is made up of several parts. What do you call each part separated by a comma?

A.

An LDAP name is made up of multiple parts that are called relative distinguished names.



Previous Page
Next Page