[python-win32] How to find corresponding WMI/COM object for given Windows Registry key?

Tim Golden mail at timgolden.me.uk
Mon Jun 18 06:54:44 CEST 2012


On 18/06/2012 00:58, Radek Holý wrote:
> My question is probably poorly formulated.
> In fact -- as I discovered -- some WMI objects reflect their values in
> the Windows Registry keys (for example there is mapping
> “root\cimv2:Win32_OSRecoveryConfiguration.AutoReboot” in
> “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\AutoReboot”).
> Is there some *common* attribute of WMI/COM/OLE objects giving the key path?

I don't believe so. The thing about WMI is that it provides a
uniform and accessible layer on top of quite a lot of lower-level
APIs. In some cases, that's a layer over registry entries; in other
cases it's a layer over an actual API call. It may even be the only
publicly-accessible means of achieving some result.

As it happens, for *methods* there is sometimes a clue as to the
underlying API. I have exposed this as (for want of a better name) the 
provenance attribute of a method class. So if you do this:

<code>
import wmi

print wmi.WMI().Win32_Process.Create.provenance

</code>

You'll see something like this:

Win32API|Process and Thread Functions|CreateProcess

I'm not aware of any such thing for attributes, although it wouldn't
surprise me utterly if there were.

>
> I must say that wmiweb is a great application.

Thanks; I rather like it myself :)

TJG


More information about the python-win32 mailing list