mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Update WMI docs / samples
This commit is contained in:
+14
-2
@@ -320,10 +320,13 @@ Ouput::
|
||||
I AM LOADING <C:\Windows\system32\ole32.dll>
|
||||
|
||||
|
||||
.. _wmi_request:
|
||||
.. _wmi_samples:
|
||||
|
||||
WMI
|
||||
"""
|
||||
|
||||
WMI requests
|
||||
""""""""""""
|
||||
''''''''''''
|
||||
|
||||
|
||||
.. literalinclude:: ..\..\samples\wmi\wmi_request.py
|
||||
@@ -332,6 +335,15 @@ Output
|
||||
|
||||
.. literalinclude:: samples_output\wmi_wmi_request.txt
|
||||
|
||||
WMI Create Process
|
||||
''''''''''''''''''
|
||||
|
||||
.. literalinclude:: ..\..\samples\wmi\create_process.py
|
||||
|
||||
Output
|
||||
|
||||
.. literalinclude:: samples_output\wmi_create_process.txt
|
||||
|
||||
|
||||
.. _sample_com:
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
(cmd) python wmi\create_process.py
|
||||
WMI namespace is <<WmiNamespace "root\cimv2">>
|
||||
Process class is <WmiObject class "Win32_Process">
|
||||
Method Create InParams is <<WmiObject class "__PARAMETERS">>
|
||||
Method Create InParams properties are <[u'CommandLine', u'CurrentDirectory', u'ProcessStartupInformation']>
|
||||
Creating instance of inparam
|
||||
InParam instance is <<WmiObject instance of "__PARAMETERS">>
|
||||
Setting <CommandLine>
|
||||
Executing method
|
||||
OutParams is <WmiObject instance of "__PARAMETERS">
|
||||
Out params values are: [u'ProcessId', u'ReturnValue']
|
||||
Created process is <WinProcess "notepad.exe" pid 24036 at 0x3d04390>
|
||||
Waiting 1s
|
||||
Killing the process
|
||||
@@ -1,28 +1,30 @@
|
||||
(cmd) python wmi\wmi_request.py
|
||||
WMI requester is <windows.winobject.wmi.WmiManager object at 0x05C70CA8>
|
||||
WMI requester is <windows.winobject.wmi.WmiManager object at 0x04258918>
|
||||
Selecting * from 'Win32_Process'
|
||||
They are <188> processes
|
||||
They are <308> processes
|
||||
Looking for ourself via pid
|
||||
Some info about our process:
|
||||
* Name -> python.exe
|
||||
* ProcessId -> 8144
|
||||
* OSName -> Microsoft Windows 10 Home|C:\WINDOWS|\Device\Harddisk0\Partition2
|
||||
* UserModeTime -> 1875000
|
||||
* WindowsVersion -> 10.0.16299
|
||||
* ProcessId -> 27144
|
||||
* OSName -> Microsoft Windows 10 Pro|C:\WINDOWS|\Device\Harddisk0\Partition2
|
||||
* UserModeTime -> 2812500
|
||||
* WindowsVersion -> 10.0.17134
|
||||
* CommandLine -> C:\Python27\python.exe wmi\wmi_request.py
|
||||
<Select Caption,FileSystem,FreeSpace from Win32_LogicalDisk>:
|
||||
* {'Caption': u'C:', 'FreeSpace': u'4704194560', 'FileSystem': u'NTFS'}
|
||||
* {'Caption': u'D:', 'FreeSpace': u'269887504384', 'FileSystem': u'NTFS'}
|
||||
* {u'Caption': u'B:', u'FreeSpace': None, u'FileSystem': None}
|
||||
* {u'Caption': u'C:', u'FreeSpace': u'5701517312', u'FileSystem': u'NTFS'}
|
||||
* {u'Caption': u'D:', u'FreeSpace': u'47657324544', u'FileSystem': u'NTFS'}
|
||||
* {u'Caption': u'E:', u'FreeSpace': u'89507512320', u'FileSystem': u'NTFS'}
|
||||
|
||||
==== Advanced use ====
|
||||
Listing some namespaces:
|
||||
* CIMV2
|
||||
* SecurityCenter2
|
||||
* StandardCimv2
|
||||
Querying non-default namespace: <WmiRequester namespace="root\SecurityCenter2">
|
||||
Querying non-default namespace: <WmiNamespace "root\SecurityCenter2">
|
||||
Listing some available classes:
|
||||
* FirewallProduct
|
||||
* AntiVirusProduct
|
||||
* AntiSpywareProduct
|
||||
* <WmiObject class "FirewallProduct">
|
||||
* <WmiObject class "AntiVirusProduct">
|
||||
* <WmiObject class "AntiSpywareProduct">
|
||||
Listing <AntiVirusProduct>:
|
||||
* Windows Defender
|
||||
|
||||
+30
-3
@@ -9,7 +9,7 @@ The :class:`WmiManager` is accessible via :py:attr:`windows.system.wmi
|
||||
|
||||
.. note::
|
||||
|
||||
See sample :ref:`wmi_request`
|
||||
See sample :ref:`wmi_samples`
|
||||
|
||||
|
||||
WmiManager
|
||||
@@ -19,7 +19,34 @@ WmiManager
|
||||
:no-inherited-members:
|
||||
:members: DEFAULT_NAMESPACE, select, query, namespaces
|
||||
|
||||
WmiRequester
|
||||
|
||||
WmiNamespace
|
||||
""""""""""""
|
||||
|
||||
.. autoclass:: WmiRequester
|
||||
.. autoclass:: WmiNamespace
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
WmiObject
|
||||
"""""""""
|
||||
|
||||
.. autoclass:: WmiObject
|
||||
:members:
|
||||
:special-members: __call__, __getitem__, __setitem__
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
WmiCallResult
|
||||
"""""""""""""
|
||||
|
||||
.. autoclass:: WmiCallResult
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
WmiEnumeration
|
||||
""""""""""""""
|
||||
|
||||
.. autoclass:: WmiEnumeration
|
||||
:members:
|
||||
:special-members: __call__, __iter__
|
||||
:show-inheritance:
|
||||
|
||||
Reference in New Issue
Block a user