使用winrm远程操作window的命令窗口,前提关闭远程机子的防火墙
# -*- coding:UTF-8 -*- import winrm ip = ‘xxx.xxx.xxx.xxx‘ #远程机器ip userName = ‘xxx‘ #用户名 password = ‘xxx‘ #密码 wintest = winrm.Session(ip, auth=(userName, password)) ret = wintest.run_cmd(‘执行命令‘) print( bytes.decode(ret.std_out))
原文地址:https://www.cnblogs.com/misslin/p/10250913.html
时间: 2024-11-12 02:33:55