pywinrm
Python library for Windows Remote Management
What it is and what it does
pywinrm is a Python client library that communicates with Windows Remote Management (WinRM) to execute commands and scripts on remote Windows systems. It abstracts the WinRM protocol over HTTP/HTTPS, handling authentication (basic, NTLM, Kerberos, CredSSP, certificate-based) and message encryption. The library provides both a high-level Session API for simple command execution and a low-level Protocol API for fine-grained control. It depends on requests, requests-ntlm, and xmltodict for HTTP communication, NTLM authentication, and XML parsing.
The package is designed for systems administrators and DevOps engineers who need to automate Windows management tasks from Linux, macOS, or Windows machines. It supports running batch scripts, PowerShell scripts, and WMI queries, with automatic endpoint URL resolution and CLIXML-to-text conversion for PowerShell error output.
Use it for:
- Automate Windows server configuration and patching from a Linux control machine using batch or PowerShell scripts.
- Query WMI data (system info, installed software, event logs) from remote Windows hosts in a Python management script.
- Build multi-platform infrastructure-as-code tools that manage both Linux and Windows systems from a single Python codebase.
- Implement custom monitoring or compliance checks that run PowerShell on remote Windows machines and parse results in Python.
- Integrate Windows command execution into orchestration workflows for heterogeneous environment management.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pywinrm is a Python client for Windows Remote Management (WinRM) that lets you run commands, PowerShell scripts, and fetch WMI data on remote Windows machines from any machine running Python.
Yes. pywinrm is actively maintained, has no known vulnerabilities, installs with low friction, and is widely used in production. It is the standard choice for Python-based Windows remote management. Install it if you need to automate Windows systems from Python.
Install
pywinrm on PyPI
pip
pip install pywinrmuv
uv add pywinrmpoetry
poetry add pywinrmInstalling pywinrm
Before you install
Low install friction with a pure-Python wheel distribution. The package is actively maintained with recent commits and is used by Ansible for Windows support, indicating production-grade reliability.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install pywinrm
import pywinrm
s = pywinrm.Session('windows-host.example.com', auth=('username', 'password'))
r = s.run_cmd('ipconfig', ['/all'])
print(r.std_out)
Requires Python 3.8 or later; target Windows machine must have WinRM enabled and accessible on port 5985 (HTTP) or 5986 (HTTPS).
Verify before relying
- Whether optional dependencies (requests-kerberos, requests-credssp) are automatically installed or require manual setup for Kerberos/CredSSP auth.
- Performance characteristics when running many concurrent remote commands or large scripts.
- Compatibility with non-standard WinRM configurations or older Windows Server versions.
Package facts
| License | Copyright (c) 2013 Alexey Diyan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — requests, requests-ntlm, xmltodict |
| Maintenance | actively maintained — 759 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,938,328/month — #1,806 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pywinrm-0.5.0-py3-none-any.whl
Keywords: winrm, ws-man, devops, ws-management
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pypsrpExecute commands, scripts, and file operations…
permissive · top 5,000 on PyPI
apache-airflow-providers-microsoft-winrmIntegrates Windows Remote Management (WinRM)…
permissive · top 15,000 on PyPI
pypsexecRuns commands on remote Windows hosts via…
permissive · top 15,000 on PyPI
smbprotocolSMBv2 and SMBv3 client library for Python that…
permissive · top 5,000 on PyPI
requests-credsspAdds CredSSP authentication support to the…
permissive · top 15,000 on PyPI
requests-negotiate-sspiAdds HTTP Negotiate authentication…
permissive · top 15,000 on PyPI
httpx-ntlmAdds NTLM authentication support to HTTPX,…
permissive · top 15,000 on PyPI
requests-ntlmAdds NTLM authentication support to the…
permissive · top 5,000 on PyPI
pyspnegoHandles SPNEGO, NTLM, Kerberos, and CredSSP…
permissive · top 1,000 on PyPI
winkerberosProvides native Kerberos client authentication…
permissive · top 5,000 on PyPI