[python-win32] WMI Performance API

Mark Hammond mhammond at skippinet.com.au
Tue Apr 11 00:13:23 CEST 2006


> I want to use the WMI Performance API to collect performance
> information from remote boxes.   To do this I need to create a
> WbemScripting. SWbemRefresher object like so:
>
> objRefresher = CreateObject("WbemScripting.SWbemRefresher")
>
> Is CreateObject something that is available from python (I have
> looked around but don't see it).  Or maybe there is another way to do
> the same thing?

win32com.client.Dispatch() is the equivalent:

import win32com.client
ob = win32com.client.Dispatch("WbemScripting.SWbemRefresher")

However, a quick google should have told you that (searching for 'python
wmi' on google shows lots of relevant hits)

> As an aside there are other APIs for getting to the performance
> info.  (I know this is a bit off topic) but does anyone know of the
> benefits or drawbacks to the different APIs.  Clearly if I can't make
> my refresher object the WMI API is out.   The Pdh stuff looks usable
> but not sure yet how this can be called remotely...

Many of the relevant functions have a 'machine' param which is the name of
the machine the function should operate on - again 'python pdh' at google
lists relevant results.

Mark



More information about the Python-win32 mailing list