This VBS script will allow you to send your Active Directory (AD) System System Management Container information to excel for your documentation and refrence.
Note: Other system containers such as your File Replication Service, IP Security and MicrosoftDNS containers can be accessed as well by changing the strContainer value from CN=System Management to CN=IP Security for example.
VBS Script:
strContainer = "CN=System Management,CN=System,"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Name"
objExcel.Cells(1, 2).Value = "Type"
objExcel.Cells(1, 3).Value = "Description"
Set objDomain = GetObject("LDAP://RootDSE")
Set objContainer = GetObject("LDAP://" & strContainer & objDomain.Get("defaultNamingContext"))
For Each objChild In objContainer
Set objClass = GetObject(objChild.Schema)
If objClass.Container = True Then
objExcel.Cells(intRow, 1).Value = objChild.Name
objExcel.Cells(intRow, 2).Value = objChild.Class
objExcel.Cells(intRow, 3).Value = objChild.Description
Else
End If
intRow = intRow + 1
Next
objExcel.Range("A1:C1").Select
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Range("A1").Select
objExcel.Cells.EntireColumn.AutoFit
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set objRange = objExcel.Range("A1")
objRange.Sort objRange,1,,,,,,1
MsgBox "Done"
No Comments