{"id":18614037,"url":"https://github.com/enthought/pywinrm-fork","last_synced_at":"2025-11-03T03:30:21.279Z","repository":{"id":66039682,"uuid":"97217261","full_name":"enthought/pywinrm-fork","owner":"enthought","description":"Default Repo description from terraform module","archived":false,"fork":false,"pushed_at":"2017-07-14T09:36:25.000Z","size":168,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-27T02:43:01.491Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enthought.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-14T09:28:23.000Z","updated_at":"2021-06-01T16:43:52.000Z","dependencies_parsed_at":"2023-05-02T15:16:08.315Z","dependency_job_id":null,"html_url":"https://github.com/enthought/pywinrm-fork","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enthought%2Fpywinrm-fork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enthought%2Fpywinrm-fork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enthought%2Fpywinrm-fork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enthought%2Fpywinrm-fork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enthought","download_url":"https://codeload.github.com/enthought/pywinrm-fork/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239406446,"owners_count":19633024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T03:24:52.376Z","updated_at":"2025-11-03T03:30:21.035Z","avatar_url":"https://github.com/enthought.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pywinrm [![Build Status](https://travis-ci.org/diyan/pywinrm.png)](https://travis-ci.org/diyan/pywinrm) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/diyan/pywinrm)](https://ci.appveyor.com/project/diyan/pywinrm) [![Coverage Status](https://coveralls.io/repos/diyan/pywinrm/badge.png)](https://coveralls.io/r/diyan/pywinrm)\n\npywinrm is a Python client for the Windows Remote Management (WinRM) service.\nIt allows you to invoke commands on target Windows machines from any machine\nthat can run Python.\n\nWinRM allows you to perform various management tasks remotely. These include, \nbut are not limited to: running batch scripts, powershell scripts, and fetching \nWMI variables.\n\nFor more information on WinRM, please visit\n[Microsoft's WinRM site](http://msdn.microsoft.com/en-us/library/aa384426.aspx).\n\n## Requirements\n* Linux, Mac OS X or Windows\n* CPython 2.6-2.7, 3.2-3.5 or PyPy 1.9\n* [requests-kerberos](http://pypi.python.org/pypi/requests-kerberos) is optional\n\n## Installation\n### To install pywinrm with support for basic, certificate, and NTLM auth, simply\n```bash\n$ pip install pywinrm\n```\n\n### To use Kerberos authentication you need these optional dependencies\n\n```bash\n# for Debian/Ubuntu/etc:\n$ sudo apt-get install python-dev libkrb5-dev\n$ pip install pywinrm[kerberos]\n\n# for RHEL/CentOS/etc:\n$ sudo yum install gcc krb5-devel krb5-workstation\n$ pip install pywinrm[kerberos]\n```\n\n## Example Usage\n### Run a process on a remote host\n```python\nimport winrm\n\ns = winrm.Session('windows-host.example.com', auth=('john.smith', 'secret'))\nr = s.run_cmd('ipconfig', ['/all'])\n\u003e\u003e\u003e r.status_code\n0\n\u003e\u003e\u003e r.std_out\nWindows IP Configuration\n\n   Host Name . . . . . . . . . . . . : WINDOWS-HOST\n   Primary Dns Suffix  . . . . . . . :\n   Node Type . . . . . . . . . . . . : Hybrid\n   IP Routing Enabled. . . . . . . . : No\n   WINS Proxy Enabled. . . . . . . . : No\n...\n\u003e\u003e\u003e r.std_err\n\n```\n\nNOTE: pywinrm will try and guess the correct endpoint url from the following formats:\n\n - windows-host -\u003e http://windows-host:5985/wsman\n - windows-host:1111 -\u003e http://windows-host:1111/wsman\n - http://windows-host -\u003e http://windows-host:5985/wsman\n - http://windows-host:1111 -\u003e http://windows-host:1111/wsman\n - http://windows-host:1111/wsman -\u003e http://windows-host:1111/wsman\n\n\n### Run Powershell script on remote host\n\n```python\nimport winrm\n\nps_script = \"\"\"$strComputer = $Host\nClear\n$RAM = WmiObject Win32_ComputerSystem\n$MB = 1048576\n\n\"Installed Memory: \" + [int]($RAM.TotalPhysicalMemory /$MB) + \" MB\" \"\"\"\n\ns = winrm.Session('windows-host.example.com', auth=('john.smith', 'secret'))\nr = s.run_ps(ps_script)\n\u003e\u003e\u003e r.status_code\n0\n\u003e\u003e\u003e r.std_out\nInstalled Memory: 3840 MB\n\n\u003e\u003e\u003e r.std_err\n\n```\n\nPowershell scripts will be base64 UTF16 little-endian encoded prior to sending to the Windows host. Error messages are converted from the Powershell CLIXML format to a human readable format as a convenience.\n\n### Run process with low-level API with domain user, disabling HTTPS cert validation\n\n```python\nfrom winrm.protocol import Protocol\n\np = Protocol(\n    endpoint='https://windows-host:5986/wsman',\n    transport='ntlm',\n    username=r'somedomain\\someuser',\n    password='secret',\n    server_cert_validation='ignore')\nshell_id = p.open_shell()\ncommand_id = p.run_command(shell_id, 'ipconfig', ['/all'])\nstd_out, std_err, status_code = p.get_command_output(shell_id, command_id)\np.cleanup_command(shell_id, command_id)\np.close_shell(shell_id)\n```\n\n### Enabling WinRM on remote host\nEnable WinRM over HTTP and HTTPS with self-signed certificate (includes firewall rules):\n\n```\n# from powershell:\nInvoke-Expression ((New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))\n```\n\nEnable WinRM over HTTP for test usage (includes firewall rules):\n```\nwinrm quickconfig\n```\n\nEnable WinRM basic authentication. For domain users, it is necessary to use NTLM or Kerberos authentication (both are enabled by default).\n```\n# from cmd:\nwinrm set winrm/config/service/auth @{Basic=\"true\"}\n```\n\nAllow unencrypted message passing over WinRM (recommended only for troubleshooting and internal use)\n```\n# from cmd:\nwinrm set winrm/config/service @{AllowUnencrypted=\"true\"}\n```\n\n### Contributors (alphabetically)\n\n- Reina Abolofia\n- Lukas Bednar\n- Chris Church\n- Matt Clark\n- Nir Cohen\n- David Cournapeau\n- Matt Davis\n- Patrick Dunnigan\n- Gema Gomez\n- Juan J. Martinez\n- Alessandro Pilotti\n- Manuel Sabban\n- Jijo Varghese\n\nWant to help - send a pull request. I will accept good pull requests for sure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenthought%2Fpywinrm-fork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenthought%2Fpywinrm-fork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenthought%2Fpywinrm-fork/lists"}