Skip to main content

WSMANIO

Examples

Shell

import asyncio

from wsmanio.shell import Encoding, Process, WinRS
from wsmanio.wsman import HTTPTransport, WSMan

async def main():
    async with (
        WSMan(
            transport=HTTPTransport(
                server_url='https://windows-server.lan:5986/wsman',
                username='username',
                password='password',
            )
        ) as wsman,
        WinRS(
            wsman=wsman,
            encoding=Encoding.UTF8,
        ) as shell,
    ):
        process = Process(shell=shell, executable='powershell', arguments=['-command', '"Get-Process | Select Name"'])
        await process.invoke()
        print(process.rc)
        print(process.stdout.decode(errors='replace'))
        print(process.stderr.decode(errors='replace'))


if __name__ == '__main__':
    asyncio.run(main())

WMI

import asyncio

from wsmanio.wmi import WMIClient
from wsmanio.wsman import HTTPTransport, WSMan

async def main():
    async with WSMan(
        transport=HTTPTransport(
            server_url='https://windows-server.lan:5986/wsman',
            username='username',
            password='password',
        )
    ) as wsman:
        wmi = WMIClient(wsman=wsman)
        result = await (
            wmi.virtualization
            .Msvm_ComputerSystem(Name='9E41B16C-E617-4B54-9515-1905CDA18C3F', CreationClassName='Msvm_ComputerSystem')
            .get()
        )
        print(result)

        result = await (
            wmi.cimv2
            .Win32_Process()
            .Create(CommandLine='notepad.exe', CurrentDirectory='C:\\')
        )
        print(result)

        result = await (
            wmi.virtualization
            .Msvm_ComputerSystem(Name='9E41B16C-E617-4B54-9515-1905CDA18C3F')
            .RequestStateChange(RequestedState='3')
        )
        print(result)


if __name__ == '__main__':
    asyncio.run(main())

Metadata

Release files for wsmanio 0.0.4

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

Source distribution (sdist)

Source distribution for wsmanio 0.0.4
File Size Uploaded
wsmanio-0.0.4.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wsmanio 0.0.4
File Interpreter ABI Platform
wsmanio-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / wsmanio-0.0.4.tar.gz

Download URL wsmanio-0.0.4.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d374c48f5da8594f01622475d9b8aeccc7fb22fab91a1b175790644fb57fa8d8
BLAKE2b-256 checksum
How to use checksums
2def6920f9a1954c93f3361b58475689b75c7cab59314641c7b9f9f82afbf871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / wsmanio-0.0.4-py3-none-any.whl

Download URL wsmanio-0.0.4-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8331cf8a7e59aacf5b8d998ebb4541bc38ca24d8572460e61cdaa9bc8a9bfdd
BLAKE2b-256 checksum
How to use checksums
af27b9d03e2f4789e9dd19321c635d8f56efc2aa9fd0d682413aa2872f7e55e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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