Query RootDSE using Python COM (Misc)

This code can be found in Chapter 20 of Active Directory Cookbook, 2nd edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the Misc code from this site.

import win32com.client

objRootDSE = win32com.client.GetObject('LDAP://RootDSE')
objRootDSE.GetInfo()

for i in range( 0, objRootDSE.PropertyCount - 1):
   prop = objRootDSE.Item(i)
   print prop.Name
   for val in prop.Values:
      print "  ",val.CaseIgnoreString

This code has been viewed 1699 times.

New from the creators of TechTasks.com: StatSheet.com