Platform SDK: Active Directory, ADSI, and Directory Services

Other High-Level Objects

In addition to Domain, and depending on the namespace provider, ADSI also offers the following high-level objects:

These objects are all containers, and they serve mostly as a convenient way to organize other objects by their physical location or their relation to a particular part of an organization.

The following script creates a new Organizational Unit and sets some of its properties:

Dim myDomain
Dim newOU

Set myDomain = GetObject("LDAP:")

Set newOU = myDomain.Create("OrganizationalUnit", "FinanceWest")
newOU.SetInfo

newOU.Description = "Finance Division for the Western Region"
newOU.LocalityName = "Western Region"
newOU.PostalAddress = "1234 Main St., Smallville, CA"
newOU.TelephoneNumber = "555-1234"
newOU.SetInfo

Notice that SetInfo is called twice in the code, once after creating the Organizational Unit, and a second time after setting its properties. The first call to SetInfo is required to commit the creation of the object to the directory; only then can you set its properties