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 should work with any version of Python from 2.1 onwards (list comprehensions) and any recent version of pywin32.

Where do I get it?

http://timgolden.me.uk/python/wmi/index.html

How do I install it?

When all’s said and done, it’s just a module. But for those who like setup programs:

python setup.py install

It’s also pip/easy_install-able

How do I use it?

There’s a tutorial here: http://timgolden.me.uk/python/wmi/tutorial.html, and some examples at: http://timgolden.me.uk/python/wmi/cookbook.html but as a quick taster, try this, to show all stopped services:

import wmi

c = wmi.WMI ()
for s in c.Win32_Service ():
  if s.State == 'Stopped':
    print s.Caption, s.State

Prerequisites

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

Windows

If you’re running Win9x / NT4 you’ll need to get WMI support from Microsoft. Microsoft URLs change quite often, so I suggest you do this: http://www.google.com/search?q=wmi+downloads

Python

http://www.python.org/ (just in case you didn’t know)

pywin32 (was win32all)

http://starship.python.net/crew/mhammond/win32/Downloads.html 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.

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.4.9.zip (26.9 kB view details)

Uploaded Source

Built Distribution

WMI-1.4.9.win32.exe (225.7 kB view details)

Uploaded Source

File details

Details for the file WMI-1.4.9.zip.

File metadata

  • Download URL: WMI-1.4.9.zip
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for WMI-1.4.9.zip
Algorithm Hash digest
SHA256 192ccfad3d7bb3ef43116d753f4d5cf85c0a6b738f832cc131e928fd93cdd400
MD5 e883e155ed5a63b742686816ec762053
BLAKE2b-256 032dcbf13257c0115bef37b6b743758411cec70c565405cbd08d0f7059bc715f

See more details on using hashes here.

File details

Details for the file WMI-1.4.9.win32.exe.

File metadata

  • Download URL: WMI-1.4.9.win32.exe
  • Upload date:
  • Size: 225.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for WMI-1.4.9.win32.exe
Algorithm Hash digest
SHA256 b1c57a5c7e27596736026ec7dd9a7c5318dad8248e7638f40c60c33cb33ac935
MD5 31ef47dc10ff13a81a0cb8e6a98a0819
BLAKE2b-256 f66b3c15ef280e2a6244ff0635f763b86fdc113654afc1192fcea8a0109f47f8

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