O'Reilly logo

Active Directory Cookbook by Robbie Allen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.18. Finding the Mandatory and Optional Attributes of a Class

Problem

You want to view the mandatory and optional attributes of a class.

Solution

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 view.

  4. Click on the Attributes tab.

Using a command-line interface

> dsquery * cn=<ClassCommonName>,cn=schema,cn=configuration,<ForestRootDN> -l[RETURN]
-scope base -attr mayContain mustContain systemMayContain systemMustContain

Using VBScript

' This code displays the mandatory and optional attributes for a class.
' ------ SCRIPT CONFIGURATION ------
' Set to common name of class to view 
strClassName = "<ClassCommonName>" ' e.g. Surname ' ------ END CONFIGURATION --------- set objRootDSE = GetObject("LDAP://RootDSE") set objClass = GetObject("LDAP://cn=" & strClassName & "," & _ objRootDSE.Get("schemaNamingContext")) WScript.Echo "Class: " & strClassName & vbCrlf ' Need to enable this so that if an attribute is not set, it won't die on error resume next WScript.Echo "mayContain:" for each strVal in objClass.Get("mayContain") WScript.Echo vbTab & strVal next WScript.Echo vbCrlf & "systemMayContain:" for each strVal in objClass.Get("systemMayContain") WScript.Echo vbTab & strVal next WScript.Echo vbCrlf & "mustContain:" for each strVal in objClass.Get("mustContain") WScript.Echo vbTab & strVal next WScript.Echo vbCrlf & "systemMustContain:" for each strVal in objClass.Get("systemMustContain") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required