[IronPython] More WMI
Keith J. Farmer
kfarmer at thuban.org
Sat Aug 28 03:45:43 CEST 2004
>>> def showAll(root):
... nsClass = ManagementClass(ManagementScope(root), ManagementPath("__namespace"), None)
... for namespace in nsClass.GetInstances():
... print "-----"
... for nsProp in namespace.Properties:
... print str(nsProp.Name), ":", str(nsProp.Value)
... print "--"
... searcher = ManagementObjectSearcher(ManagementScope("root\\" + str(namespace.GetPropertyValue("Name"))), WqlObjectQuery("select * from meta_class"), None)
... for wmiClass in searcher.Get():
... print "Class:", wmiClass.GetPropertyValue("__CLASS")
showAll("root")
.. lots of scroll.
Bug: "root\\" needs to actually be the real path of the parent namespace if you expect to show anything under, say, "root\CIMV2"
More information about the Ironpython-users
mailing list