[python-win32] wmi query.
Marcus Low
marcus at internetnowasp.net
Mon Mar 24 10:36:53 CET 2008
Hi,
> c = wmi.WMI()
> for service in c.Win32_Service ('State == 'Stopped')
I would think that using c.Win32_Service() and iterating would get you anything you want.
In ur case of using ('State == 'Stopped') ... (if this ever works)
c.Caption would have given you the caption....
Marcus.
----- Original Message -----
From: mark.a.brand
To: Python-Win32 List
Sent: Monday, March 24, 2008 10:06 AM
Subject: [python-win32] wmi query.
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
------------------------------------------------------------------------------
_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080324/b087137a/attachment.htm
More information about the python-win32
mailing list