--- id: pypsexec version: "0.3.0" license: MIT license_treatment: permissive maintenance: aging --- # pypsexec — Run commands on a remote Windows host using SMB/RPC License: permissive · Maintenance: aging · Downloads: 177.5K/mo ## What it is and what it does pypsexec is a Python library that executes commands on remote Windows hosts using SMB and RPC protocols, mimicking the behavior of the PsExec tool. It works cross-platform—you can run it from Linux, macOS, or Windows—and does not require PsExec binaries to be installed on the local machine. The library handles the full lifecycle: establishing an SMB connection, copying a PAExec binary to the remote ADMIN$ share, creating a Windows service to run the binary, piping commands and capturing output, and cleaning up afterward. The package supports running processes as specific users (local, domain, or SYSTEM), interactive sessions, custom process priorities, timeouts, stdin input, and processor affinity. By default it encrypts data in transit using SMB encryption, though older Windows versions (7, Server 2008, Server 2008 R2) do not support this and fall back to XOR scrambling. The main runtime dependency is smbprotocol; Kerberos authentication is optional and requires additional system libraries. Use it for: - Automate administrative tasks on remote Windows servers from a Python script running on any OS. - Deploy or execute batch jobs on Windows hosts without installing PsExec or managing separate binaries. - Run diagnostics or remediation commands on multiple Windows machines as part of a larger orchestration workflow. - Execute commands under specific user accounts or the SYSTEM account for privilege-level testing or service management. - Capture stdout and stderr from remote processes for logging or real-time monitoring in a centralized Python application. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Runs commands on remote Windows hosts via SMB/RPC without requiring local binaries or a specific operating system, using Python to replicate PsExec functionality. Yes, if you need to run commands on remote Windows hosts from Python and can meet the prerequisites (SMB access, admin credentials, appropriate UAC configuration). The low install friction and permissive license make it straightforward to add. However, note that the package has not been updated since 2021; if you require active maintenance or support for the latest Windows or Python versions, verify compatibility first or consider whether an actively maintained alternative exists. ## Install pip install pypsexec uv add pypsexec poetry add pypsexec ## Installing pypsexec Before you install: Low install friction with a single runtime dependency (smbprotocol). The package is aging—last release was 2021-10-21 and no updates in over three years—but the repository remains active with recent commits and no archived status. License in practice: MIT license is permissive, allowing commercial and private use with minimal restrictions; you may use and modify the code freely as long as you include the license notice. Quickstart: pip install pypsexec from pypsexec.client import Client client = Client('remote_host', username='user', password='pass') client.connect() stdout, stderr, rc = client.run_executable('cmd.exe', arguments='/c whoami') client.disconnect() Remote Windows host must have SMB port 445 open, ADMIN$ share enabled with read/write access, and the connecting user must be an administrator or have appropriate token rights (UAC filtering may block non-admin tokens). Verify before relying: - Whether the package works with modern Windows Server versions beyond those documented in the description. - Current compatibility with Python 3.10+ given the last release predates those versions. - Whether smbprotocol's optional Kerberos support is automatically available or requires separate installation. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 177.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags remote command execution windows, psexec python, smb rpc command runner, windows remote administration, cross-platform psexec, python windows service execution, remote process management windows, windows-administration, remote-execution, smb-protocol [View on SkillFed](https://skillfed.io/packages/pypsexec) · [View on PyPI](https://pypi.org/project/pypsexec/)