import winrm

win2012 = winrm.Session('http://192.168.0.19:5985/wsman',auth=('wt','635870838'))


r = win2012.run_cmd('D: &'
                    ' cd python &'
                    ' type s.txt &'
 ' net stop iphlpsvc
') # net stop iphlpsvc 是关闭iphlpsvc服务 print(r.std_out.decode()) # 打印获取到的信息 print(r.std_err) #打印错误信息 注意:需要在被控机上开启以下服务: 针对winrm service 进行基础配置: winrm quickconfig 查看winrm service listener: winrm e winrm/config/listener 为winrm service 配置auth: winrm set winrm/config/service/auth @{Basic="true"} 为winrm service 配置加密方式为允许非加密: winrm set winrm/config/service @{AllowUnencrypted="true"}

 

相关文章:

  • 2021-05-16
  • 2021-11-08
  • 2021-08-15
  • 2021-09-23
  • 2021-12-21
  • 2022-02-08
  • 2021-09-05
  • 2021-06-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2021-05-29
相关资源
相似解决方案