Skip to main content

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].

Release files for WMI 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for WMI 1.5.1
File Size Uploaded
WMI-1.5.1.tar.gz 26.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for WMI 1.5.1
File Interpreter ABI Platform
WMI-1.5.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 55.2 kB

Release files / WMI-1.5.1.tar.gz

Download URL WMI-1.5.1.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b6a6be5711b1b6c8d55bda7a8befd75c48c12b770b9d227d31c1737dbf0d40a6
BLAKE2b-256 checksum
How to use checksums
d4666364deb0a03415f96c66803d8c4379f808f2401da3bdb183348487b10510
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / WMI-1.5.1-py2.py3-none-any.whl

Download URL WMI-1.5.1-py2.py3-none-any.whl
Size 28.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1d6b085e5c445141c475476000b661f60fff1aaa19f76bf82b7abb92e0ff4942
BLAKE2b-256 checksum
How to use checksums
eeb9a80d1ed4d115dac8e2ac08d16af046a77ab58e3d186e22395bf2add24090
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files

1.5

2 release files

1.4.9

2 release files

1.4.8

2 release files

1.4.7

1.4.6

1.3.2

1.3

1.2

1.1

1.0

1.0rc4

1.0rc3

1.0rc1

0.6

0.5

0.3

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page