Skip to main content

Windows Management Instrumentation

Project description

What is it?

Windows Management Instrumentation (WMI) is Microsoft’s implementation of Web-Based Enterprise Management (WBEM), an industry initiative to provide a Common Information Model (CIM) for pretty much any information about a computer system.

The Python WMI module is a lightweight wrapper on top of the pywin32 extensions, and hides some of the messy plumbing needed to get Python to talk to the WMI API. It’s pure Python and has been tested against all versions of Python from 2.5 to 3.4. It should work with any recent version of pywin32.

Where do I get it?

How do I install it?

pip install wmi

How do I use it?

Have a look at the tutorial or the cookbook. As a quick taster, try this, to find all Automatic services which are not running and offer the option to restart each one:

import wmi

c = wmi.WMI()
for s in c.Win32_Service(StartMode="Auto", State="Stopped"):
    if raw_input("Restart %s? " % s.Caption).upper() == "Y":
        s.StartService()

What’s Changed?

See the changes document

Prerequisites

If you’re running a recent Python (2.5+) on a recent Windows (2k, 2k3, 2012, XP, Vista, 7, 8.x) and you have Mark Hammond’s win32 extensions installed, you’re probably up-and-running already. Otherwise…

Python

http://www.python.org/

pywin32 (was win32all)

http://sourceforge.net/projects/pywin32/files/

Specifically, builds 154/155 fixed a problem which affected the WMI moniker construction. You can still work without this fix, but some more complex monikers will fail. (The current build is 219 so you’re probably ok unless you have some very stringent backwards-compatible requirement).

makepy

(NB my own experience over several systems is that this step isn’t necessary. However, if you have problems…) You may have to compile makepy support for some typelibs. The following are reported to be significant:

  • Microsoft WMI Scripting Library

  • WMI ADSI Extension Type Library

  • WMICntl Type Library

If you’ve not done this before, start the PythonWin environment, select Tools > Com Makepy utility from the menu, select the library by name, and click [OK].

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WMI-1.5.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

WMI-1.5-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file WMI-1.5.tar.gz.

File metadata

  • Download URL: WMI-1.5.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for WMI-1.5.tar.gz
Algorithm Hash digest
SHA256 cd658bb98567f8c147233143b4a082169cac2cc07f410e69499c55ae98bb6c92
MD5 9e5deffd973f12df41466240fc3f9ea4
BLAKE2b-256 cd4e2e1112db249db0f2f5e9d43c261d6698a478793c49dfd905251823946b19

See more details on using hashes here.

File details

Details for the file WMI-1.5-py3-none-any.whl.

File metadata

  • Download URL: WMI-1.5-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for WMI-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cddedfbf850a75eea1664fa572e841df858bffc51072051e0ebd46471c8c31b4
MD5 718e6008e60b5508190cadf4eb7af7f7
BLAKE2b-256 853a5f1fcc9449e1f418eac21a20a601d8e4a5fe937e0680d945cc4304fc3eda

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page