skillfed

pywinrm

Python library for Windows Remote Management

pywinrm v0.5.0 6.9M downloads/30d#1,806 on PyPI1,137
Permissive 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) Active released

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 pywinrm

uv

uv add pywinrm

poetry

poetry add pywinrm

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: System :: ClusteringTopic :: System :: Distributed ComputingTopic :: System :: Systems Administration

Tags

windows remote management pythonwinrm client libraryremote command execution windowspowershell script automationwindows system administration pythonntlm kerberos authenticationremote windows management
windows-automationremote-executiondevops

More Python Modules packages