To make talking about it easier, I've slightly reworked
your code to make it run completely (ie I've added imports and
the initialisation of the data structures) and
to take advantage of the wmi module's built-in features.
Hopefully it's perfectly clear what's going on; I've just avoided
some
Nick Moszer wrote:
Hello,
I'm occasionally receiving the following error when doing a set of queries:
Traceback (most recent call last):
File "psg5220_demo.py", line 236, in find_hdd_drives
partitions = services.query(query)
File "...path..\wmi.py", line 889, in query
return [ _wmi
lovely, thanks again.
On 26/03/2008, Tim Golden <[EMAIL PROTECTED]> wrote:
>
> mark.a.brand wrote:
> > what about events,
> >
> > for example i only want to return error and warning events for the last
> 4
> > days from all logs. getting all the events and then filtering them will
> be
> > terrri
mark.a.brand wrote:
> what about events,
>
> for example i only want to return error and warning events for the last 4
> days from all logs. getting all the events and then filtering them will be
> terrribly slow.
You let WMI do the filtering. For this, since it's a non-equi
filter (you want the
hi tim:
what about events,
for example i only want to return error and warning events for the last 4
days from all logs. getting all the events and then filtering them will be
terrribly slow.
cheers
mark
On 26/03/2008, Tim Golden <[EMAIL PROTECTED]> wrote:
>
> mark.a.brand wrote:
> > thanks t
Tim Golden wrote:
[... snip other examples ...]
> Even that is a slight optimisation. It usually costs little
> to pull back all the fields, so I generally write:
>
>
> import wmi
>
> c = wmi.WMI ()
> for service in c.Win32_Service (state="Stopped"):
>print c.Caption, c.Status
>
>
Sorr
mark.a.brand wrote:
> 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 stop
mark.a.brand wrote:
> 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 stop
mark.a.brand wrote:
> 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 stop
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.
-
10 matches
Mail list logo