2.9. WMI – Make request to WMI

Note

See sample WMI requests

2.9.1. WmiManager

class windows.winobject.wmi.WmiManager[source]

The main WMI class exposed, used to list and access differents WMI namespace, can be used as a dict to access WmiRequester by namespace

Example:
>>> windows.system.wmi["root\SecurityCenter2"]
<WmiRequester namespace="root\SecurityCenter2">
DEFAULT_NAMESPACE = 'root\\cimv2'

The default namespace for select() & query()

namespaces

The list of available WMI namespaces

query

WmiRequester.query() for default WMI namespace ‘root\cimv2’

select

WmiRequester.select() for default WMI namespace ‘root\cimv2’

2.9.2. WmiRequester

class windows.winobject.wmi.WmiRequester(target='root\cimv2', user=None, password=None)[source]

An object to perform wmi request to root\cimv2

classes

The list of class available

Return type:list of str
gen_query(query, attrs='*', timeout=tag_WBEM_TIMEOUT_TYPE.WBEM_INFINITE(0xffffffffL))[source]

Execute WMI query and return a generator that will yield the attrs for one object each time. Each iteration is susceptible to raise.

Return type:generator
gen_select(frm, attrs='*', **kwargs)[source]

Select attrs from frm in a generator (like gen_query())

Return type:generator
query(query, attrs='*', timeout=tag_WBEM_TIMEOUT_TYPE.WBEM_INFINITE(0xffffffffL))[source]

Execute WMI query and return the attributes attrs Timeout is not applied for the full query time but the time to retrieve one object each time.

Return type:list of dict
select(frm, attrs='*', **kwargs)[source]

Select attrs from frm

Return type:list of dict