如何使用pywinrm执行powershell命令?

2024-10-01 07:18:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用带有python2.6的Linux机器,并且希望在远程windows服务器上执行一些PowerShell命令。在

我使用了pywinrm,下面是代码:

import winrm
st = winrm.Session('ABC0634176', auth=('Administrator', '#root123'))
r = st.run_cmd('ipconfig', ['/all'])

但下面的错误:

enter image description here

请帮助获取解决方案,如何运行PowerShell命令。 有没有其他图书馆也有同样的用途?在


Tags: 代码import命令服务器机器auth远程session