' ------------------------------------------------------------------------- ' From the book Inside Active Directory, ISBN 0-201-61621-1 ' Copyright (C) 2002 by Addison-Wesley ' Script by Sakari Kouti (see http://www.kouti.com) ' You have a royalty-free right to use, modify, reproduce and distribute ' this script (and/or any modified version) in any way you find useful, ' provided that you agree that Addison-Wesley or Sakari Kouti has no ' warranty, obligations or liability for the script. If you modify ' the script, you must retain this copyright notice. ' ------------------------------------------------------------------------- Option Explicit Dim objExcel, objClass, strPropName, strGivenClass, strSheetName strGivenClass = InputBox("Enter a class LDAP name") Set objExcel = WScript.CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add strSheetName = "Attrs of " & strGivenClass If Len(strSheetName) > 31 Then _ strSheetName = Left(strSheetName,28) & "..." objExcel.ActiveSheet.Name = strSheetName objExcel.ActiveSheet.Range("A1").Activate objExcel.ActiveCell.Value = "Attr LDAP Name" objExcel.ActiveCell.Offset(0, 1).Value = "M/O" objExcel.ActiveCell.Offset(0, 2).Value = "Syntax" objExcel.ActiveCell.Offset(0, 3).Value = "MultiValued" objExcel.ActiveCell.Offset(0, 4).Value = "MinRange" objExcel.ActiveCell.Offset(0, 5).Value = "MaxRange" objExcel.ActiveCell.Offset(0, 6).Value = "OID" objExcel.ActiveCell.Offset(1, 0).Activate Set objClass = GetObject("LDAP://schema/" & strGivenClass) For Each strPropName In objClass.MandatoryProperties Call ShowAttrAndFeatures("Mandatory", strPropName) Next For Each strPropName In objClass.OptionalProperties Call ShowAttrAndFeatures("Optional", strPropName) Next Sub ShowAttrAndFeatures(strManOrOpt, strPropName) Dim objAttribute On Error Resume Next Set objAttribute = GetObject("LDAP://schema/" & strPropName) objExcel.ActiveCell.Value = strPropName objExcel.ActiveCell.Offset(0, 1).Value = strManOrOpt With objAttribute objExcel.ActiveCell.Offset(0, 2).Value = .Syntax objExcel.ActiveCell.Offset(0, 3).Value = .MultiValued objExcel.ActiveCell.Offset(0, 4).Value = .MinRange objExcel.ActiveCell.Offset(0, 5).Value = .MaxRange objExcel.ActiveCell.Offset(0, 6).Value = .OID End With objExcel.ActiveCell.Offset(1, 0).Activate End Sub