Recipe 10.17 Finding the Structural, Auxiliary, Abstract, and 88 Classes

10.17.1 Problem

You want to list the structural, auxiliary, abstract, and 88 classes.

10.17.2 Solution

10.17.2.1 Using a graphical user interface
  1. Open the Active Directory Schema snap-in.

  2. In the left pane, click on the Classes folder.

  3. In the right pane, the list of all the classes will be displayed. The Type column contains the type of class. Even though you can click on the column header, it currently does not sort the classes by type.

10.17.2.2 Using a command-line interface
> dsquery * cn=schema,cn=configuration,<ForestRootDN> -limit 0 -scope onelevel[RETURN]
-filter "(objectcategory=classSchema)" -attr lDAPDisplayName objectclasscategory
10.17.2.3 Using VBScript
' This code prints out classes of a particular type
' ------ SCRIPT CONFIGURATION ------
' Set the following to TRUE or FALSE depending if you want to 
' view or not view classes of the type defined by the variable
boolShowStructural = TRUE 
boolShowAuxiliary  = TRUE
boolShowAbstract   = TRUE 
boolShow88         = TRUE 
' ------ END CONFIGURATION ---------

set objRootDSE = GetObject("LDAP://RootDSE")
set objSchemaCont = GetObject("LDAP://cn=schema," & _
                              objRootDSE.Get("configurationNamingContext"))
objSchemaCont.Filter = Array("classSchema")
WScript.Echo "Loading classes, this will take a few seconds."
for each objClass in objSchemaCont
   WScript.StdOut.Write(".")
   if objClass.Get("objectClassCategory") = 0 then
      str88 = str88 & vbTab & objClass.Get("lDAPDisplayName") & vbCrlf
   elseif objClass.Get("objectClassCategory") = 1 then
      strStruct = strStruct & vbTab & _
                  objClass.Get("lDAPDisplayName") & vbCrlf
   elseif objClass.Get("objectClassCategory") = 2 then 
      strAbst = strAbst & vbTab & objClass.Get("lDAPDisplayName") & vbCrlf
   elseif objClass.Get("objectClassCategory") = 3 then
      strAux = strAux & vbTab & objClass.Get("lDAPDisplayName") & vbCrlf
   else
      WScript.Echo "Unknown class type: " & _
                   objClass.Get("lDAPDisplayName") & vbCrlf
   end if
next
WScript.Echo vbCrlf

if boolShowStructural = TRUE then
   WScript.Echo "Structural Classes: "
   WScript.Echo strStruct
   WScript.Echo
end if

if boolShowAbstract = TRUE then
   WScript.Echo "Abstract Classes: "
   WScript.Echo strAbst
   WScript.Echo
end if

if boolShowAuxiliary = TRUE then
   WScript.Echo "Auxiliary Classes: "
   WScript.Echo strAux
   WScript.Echo
end if

if boolShow88 = TRUE then
   WScript.Echo "88 Classes: "
   WScript.Echo str88
   WScript.Echo
end if

10.17.3 Discussion

There are four supported class types in the Active Directory schema. The class type is defined by the objectClassCategory attribute on classSchema objects. Each class type is used for a different purpose relating to organizing and inheriting classes. Table 10-6 describes each type.

Table 10-6. Object class category values

Name

Value

Description

88

0

Legacy class type defined by the original X.500 standards. It should not be used for new classes.

Structural

1

Used for instantiating objects. Can be comprised of abstract, auxiliary, and other structural classes.

Abstract

2

Used to define a high-level grouping of attributes that can be used as part of other abstract or structural class definitions. Objects cannot be instantiated using an abstract class.

Auxiliary

3

Used as a collection of attributes that can be applied to other abstract, auxiliary, or structural classes.



    Chapter 3. Domain Controllers, Global Catalogs, and FSMOs
    Chapter 6. Users
    Appendix A. Tool List