This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Windows Management Infrastructure API for Python.

Project Description

This project provides a Python native module wrapper over the Windows Management Infrastructure (MI) API [1].

Works with Python 2.7 and 3.x on any Windows version which supports the MI API, both x86 and x64.

It includes also a drop-in replacement for the Python WMI [2] module, proving much faster execution times and no dependency on pywin32.

Installation

Pip is the preferred way to install PyMI. Pre-compiled binary wheels are available on Pypi [3]:

pip install PyMI

Usage

This project can be used either with a lower level interface that reflects the underlying MI API structure or with the higher level (and slightly slower) WMI module replacement.

MI module basic usage

Here’s a simple example which enumerates all processes and kills any instance of “KillerRabbitOfCaerbannog.exe”.

import mi

with mi.Application() as a:
    with a.create_session(protocol=mi.PROTOCOL_WMIDCOM) as s:
        proc_name = u'notepad.exe'
        with s.exec_query(
                u"root\\cimv2", u"select * from Win32_Process") as q:
            i = q.get_next_instance()
            while i is not None:
                if i[u'name'].lower() == u"KillerRabbitOfCaerbannog.exe":
                    cls = i.get_class()
                    # Prepare parameters
                    params = a.create_method_params(cls, u"Terminate")
                    # Exit code
                    params['reason'] = 10
                    # Invoke method
                    with s.invoke_method(i, u"Terminate", params) as op:
                        op.get_next_instance()
                i = q.get_next_instance()

WMI module basic usage

And here’s the same example written using the WMI module replacement, which provides a simpler and higher level interface over the mi API:

import wmi

conn = wmi.WMI()
for p in conn.Win32_Process():
    if p.Name == u"KillerRabbitOfCaerbannog.exe":
        p.Terminate(reason=10)

Build

Open the provided PyMI.sln solution in Visual Studio 2015 [4], choose your target Python version / platform and build. Wheel packages are automatically generated in the dist folder for release builds.

Note: the target Python version must be present. The Python path can be customized by setting the corresponding PythonDir* user macro, e.g. PythonDir_34_x64.

Release History

Release History

This version
History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

1.0.2.dev2

History Node

1.0.2.dev1

History Node

1.0.1

History Node

1.0.1.dev1

History Node

1.0.0

History Node

1.0.0.dev15

History Node

1.0.0.dev14

History Node

1.0.0.dev13

History Node

1.0.0.dev12

History Node

1.0.0.dev11

History Node

1.0.0.dev10

History Node

1.0.0.dev9

History Node

1.0.0.dev8

History Node

1.0.0.dev7

History Node

1.0.0.dev6

History Node

1.0.0.dev5

History Node

1.0.0.dev4

History Node

1.0.0.dev3

History Node

1.0.0.dev2

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PyMI-1.0.4-cp27-none-win32.whl (2.0 MB) Copy SHA256 Checksum SHA256 2.7 Wheel Sep 28, 2016
PyMI-1.0.4-cp27-none-win_amd64.whl (2.1 MB) Copy SHA256 Checksum SHA256 2.7 Wheel Sep 28, 2016
PyMI-1.0.4-cp34-none-win_amd64.whl (2.1 MB) Copy SHA256 Checksum SHA256 3.4 Wheel Sep 28, 2016
PyMI-1.0.4-cp35-none-win_amd64.whl (2.1 MB) Copy SHA256 Checksum SHA256 3.5 Wheel Apr 12, 2017
PyMI-1.0.4.zip (2.0 MB) Copy SHA256 Checksum SHA256 Source Sep 28, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting