Hi Tim, Thanks to your help, here's what I'm using to record interesting information about our workstation inventory. It works great!
c = wmi.WMI().Win32_ComputerSystem computer = c()[0] for propertyName in sorted( list( c.properties ) ): print '%s = %s' % ( propertyName, getattr( computer, propertyName, '' ) ) For those searching the archives, the same technique can be used to capture BIOS info as well using the following replacement line. c = wmi.WMI().Win32_BIOS Thank you very much for your help and for all your Win32 contributions!!! Cheers, Malcolm ----- Original message ----- From: "Tim Golden" <m...@timgolden.me.uk> To: Cc: "zz Python Win32 Newsgroup" <python-win32@python.org> Date: Thu, 04 Mar 2010 08:49:28 +0000 Subject: Re: [python-win32] How to enumerate a WMI object to discover its properties? On 04/03/2010 06:38, pyt...@bdurham.com wrote: > Is there a way to enumerate a WMI object's properties to discover > what they are vs. having to explictly reference properties by > name? Assuming I understand the question, a quickie shortcut is just to "print" the object: <code> import wmi c = wmi.WMI () for s in c.Win32_ComputerSystem (): print s </code> but in fact each object also holds a list of its own properties: <code> import wmi c = wmi.WMI () print list (c.Win32_ComputerSystem.properties) print list (c.Win32_ComputerSystem.methods) or you can do the same with an instance: for s in c.Win32_ComputerSystem (): print list (s.properties) </code> _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32