[python-win32] wmi query.

mark.a.brand mark.a.brand at gmail.com
Mon Mar 24 03:06:18 CET 2008


hi:

how do you incorporate a where clause and selected field clause in a wmi
query ?

this gets me caption and state fields for all services
  c = wmi.WMI()
  for service in c.Win32_Service (['Caption', 'State'])
     ...

this gets me all fields for stopped services
c = wmi.WMI()
for service in c.Win32_Service ('State == 'Stopped')
   ....

is the way to incorporate both queries into one something like this
c = wmi.WMI()
for service in c.Win32_Service (['Caption', 'State'])  WHERE ('State ==
'Stopped')

cheers
mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080324/6d94d12f/attachment.htm 


More information about the python-win32 mailing list