Library for WinRM
Project description
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())
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
wsmanio-0.0.3.tar.gz
(16.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
wsmanio-0.0.3-py3-none-any.whl
(23.2 kB
view details)
File details
Details for the file wsmanio-0.0.3.tar.gz.
File metadata
- Download URL: wsmanio-0.0.3.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeef329b0606dcac0e53616d3e6155f927e481ee481a7f81ba71f9de5403f9a3
|
|
| MD5 |
91d27301a7e9c7e0cffe47af29aafb41
|
|
| BLAKE2b-256 |
1d9de4e0d0e0e0a35cd417539953e77de55a662840eb9eeaddde0c86a0c82d72
|
File details
Details for the file wsmanio-0.0.3-py3-none-any.whl.
File metadata
- Download URL: wsmanio-0.0.3-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa5b298527a2fbca210861cb62ee7f343c077bd197280e257e021659c5292881
|
|
| MD5 |
8ac7269721475c3cb465f288659d84da
|
|
| BLAKE2b-256 |
f31f6bfb0e9cb8b9a5e56b89297f990f27aef568b96a1a5b7c89aca74c7f2a09
|