[python-win32] WMI qualifier

Tim Golden mail at timgolden.me.uk
Fri Nov 12 09:57:46 CET 2010


On 04/11/2010 15:13, ^_^Sisyphus^_^ wrote:
> I start to use WMI python binding recently. I want to know whether there is
> any way to retrieve the qualifier information of a WMI object?
> For example, in Win32_Process the OtherTransferCountData has a unit in bytes
> but PageFileUsageData has a unit in kilobytes:
> OtherTransferCountData type: uint64 Access type: Read-only Qualifiers: Units
> (Bytes)
> PageFileUsageData type: uint32 Access type: Read-only Qualifiers: Units
> (Kilobytes)
> How could I retrieve those string value from their qualifiers, such as:
> 'Bytes', 'Kilobytes'?

This is a little bit fiddly (basically because I haven't exposed the
information straightforwardly):

<code>
import wmi
c = wmi.WMI ()

for p in c.Win32_Process.Properties_:
   for q in p.Qualifiers_:
     if q.Name == "Units":
       print p.Name, "=>", q.Value
       break

</code>

TJG


More information about the python-win32 mailing list