DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 10.20 Deactivating Classes and Attributes

10.20.1 Problem

You want to deactivate a class or attribute in the schema because you no longer need it.

10.20.2 Solution

10.20.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, double-click the class you want to deactivate.

  4. Uncheck the box beside Class is active.

  5. Click OK.

10.20.2.2 Using a command-line interface

You can deactivate a class using the ldifde utility and an LDIF file that contains the following lines:

dn: cn=<SchemaObjectCommonName>,cn=schema,cn=configuration,<ForestRootDN>
changetype: modify
replace: isDefunct
isDefunct: TRUE
-

If the LDIF file were named deactivate_class.ldf, you would run the following command:

> ldifde -v -i -f deactivate_class.ldf
10.20.2.3 Using VBScript
' This code deactivates a class or attribute.
' ------ SCRIPT CONFIGURATION ------
strName = "<SchemaObjectCommonName>"   ' e.g. rallencorp-LanguagesSpoken
' ------ END CONFIGURATION ---------

set objRootDSE = GetObject("LDAP://RootDSE")
set objSchemaObject = GetObject("LDAP://cn=" & strName & "," & _
                                objRootDSE.Get("schemaNamingContext"))
objSchemaObject.Put "isDefunct", TRUE
objSchemaObject.SetInfo
WScript.Echo "Schema object deactivated: " & strName

10.20.3 Discussion

There is no supported way to delete classes or attributes defined in the schema. You can, however, deactivate them, also known as making them defunct. Before you deactivate a class you should make sure that no instantiated objects of that class exist. If you want to deactivate an attribute, you should make sure no object classes define the attribute as mandatory. After you've verified the class or attribute is no longer being used, you can deactivate by setting the isDefunct attribute to TRUE. You can always reactivate it at a later time by simply setting isDefunct to FALSE. With Windows Server 2003 Active Directory, you can even redefine the class or attribute while it is defunct. This gives you much more flexibility over reusing classes or attributes you may have added before, but no longer want.

10.20.4 See Also

Recipe 10.21 for redefining classes and attributes

    [ Team LiB ] Previous Section Next Section