Python远程连接Windows,并调用Windows命令(类似于paramiko)
import winrm win2012 = winrm.Session('http://192.168.0.19:5985/wsman',auth=('wt','')) 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"}
Python远程连接Windows,并调用Windows命令(类似于paramiko)的更多相关文章
- python远程连接paramiko 模块和堡垒机实现
paramiko使用 paramiko模块是基于python实现了SSH2远程安全连接,支持认证和密钥方式,可以实现远程连接.命令执行.文件传输.中间SSH代理功能 安装 pip install pa ...
- Python远程连接模块-Telnet
Python远程连接模块-Telnet 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 虽然现在主流的python版本还是2.7,相信2020年python程序员都会偏向Python ...
- Python 使用Python远程连接并操作InfluxDB数据库
使用Python远程连接并操作InfluxDB数据库 by:授客 QQ:1033553122 实践环境 Python 3.4.0 CentOS 6 64位(内核版本2.6.32-642.el6.x86 ...
- Python远程连接Redis
import redisr=redis.Redis(host='192.168.56.102',port=6379,db=0,password='jinxfredis' )r.set('name',' ...
- python远程连接windows
远程连接windows系统 https://blog.51cto.com/ckl893/2145809 import winrm win2008 = winrm.Session('http:/ ...
- Python远程连接MySQL数据库
使用Python连接数据库首先需要安装Python的数据库驱动. 我的本地只装了Python,并没有装MySQL,当我使用命令: sudo pip install mysql-python 安装驱动( ...
- ssh远程连接linux服务器并执行命令
详细方法: SSHClient中的方法 参数和参数说明 connect(实现ssh连接和校验) hostname:目标主机地址 port:主机端口 username:校验的用户名 password:登 ...
- 项目笔记---Windows Service调用Windows API问题
概要 此文来自于最近一个“诡异”的Windows API调用发现Windows Service在调用某些Windows API的过程中失效,在经过漫长的Baidu,之后终于在StackOverFlow ...
- 使用Nodejs在Windows上调用CMD命令
要用nodejs执行cmd,需要引入一个包node-cmd npm install node-cmd var cmd=require('node-cmd'); cmd.get( 'notepad',/ ...
随机推荐
- EF 热加载 Winform/Asp.net
public partial class Form1 : Form { BackgroundWorker worker = new BackgroundWorker(); xxContext cont ...
- C# LINQ(5)
目前都是说的单数据差距,如果多数据进行查询LINQ该如何呢? 那么LINQ就应该使用关键字 join on equals 现有代码: static void Main(string[] args) { ...
- 《javascript 高级程序设计》 笔记1 1~7章
chapter 2 在html中使用JavaScript chapter 3 基本概念 EMCAscript 语法 变量,函数名和操作符都区分大小写. 使用var定义的变量将成为定义该变量的作用域中的 ...
- C# 小球100米自由落下
//一球从N 米高自由落下,每次落地后反跳回原高度的一般:再录下,求它在第十次落地时,共经过多少米?第10次反弹多高 static string ballDsitance(float height1, ...
- python2和python3 分别连接MySQL的代码
python2中的写法如下: #coding=utf-8 import MySQLdb try: conn = MySQLdb.connect(host='localhost', port=3306, ...
- postgresql编译安装与调试(一)
因为最近组里的项目和postgresql有关,并且需要查看和调试源码,所以专门学习了一下如何安装和调试postgresql,此博文用来记录自己的安装和调试过程.安装环境是CentOS6(CentOS7 ...
- 【BZOJ 2679】[Usaco2012 Open]Balanced Cow Subsets(折半搜索+双指针)
[Usaco2012 Open]Balanced Cow Subsets 题目描述 给出\(N(1≤N≤20)\)个数\(M(i) (1 <= M(i) <= 100,000,000)\) ...
- undefined reference to symbol ‘_ZN2cv6String10deallocateEv
使用qt编译Caffe时出现如下错误: undefined reference to symbol '_ZN2cv6String10deallocateEv' error adding symbols ...
- 109th LeetCode Weekly Contest Number of Recent Calls
Write a class RecentCounter to count recent requests. It has only one method: ping(int t), where t r ...
- Oracle sql 中的 ALL,ANY,SOME
[转自] http://www.itpub.net/thread-1355835-1-1.html any和some是等价的,其与all的前面都只能是比较符号,即=, !=, >, <, ...