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)的更多相关文章

  1. python远程连接paramiko 模块和堡垒机实现

    paramiko使用 paramiko模块是基于python实现了SSH2远程安全连接,支持认证和密钥方式,可以实现远程连接.命令执行.文件传输.中间SSH代理功能 安装 pip install pa ...

  2. Python远程连接模块-Telnet

    Python远程连接模块-Telnet 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 虽然现在主流的python版本还是2.7,相信2020年python程序员都会偏向Python ...

  3. Python 使用Python远程连接并操作InfluxDB数据库

    使用Python远程连接并操作InfluxDB数据库 by:授客 QQ:1033553122 实践环境 Python 3.4.0 CentOS 6 64位(内核版本2.6.32-642.el6.x86 ...

  4. Python远程连接Redis

    import redisr=redis.Redis(host='192.168.56.102',port=6379,db=0,password='jinxfredis' )r.set('name',' ...

  5. python远程连接windows

    远程连接windows系统     https://blog.51cto.com/ckl893/2145809 import winrm win2008 = winrm.Session('http:/ ...

  6. Python远程连接MySQL数据库

    使用Python连接数据库首先需要安装Python的数据库驱动. 我的本地只装了Python,并没有装MySQL,当我使用命令: sudo pip install mysql-python 安装驱动( ...

  7. ssh远程连接linux服务器并执行命令

    详细方法: SSHClient中的方法 参数和参数说明 connect(实现ssh连接和校验) hostname:目标主机地址 port:主机端口 username:校验的用户名 password:登 ...

  8. 项目笔记---Windows Service调用Windows API问题

    概要 此文来自于最近一个“诡异”的Windows API调用发现Windows Service在调用某些Windows API的过程中失效,在经过漫长的Baidu,之后终于在StackOverFlow ...

  9. 使用Nodejs在Windows上调用CMD命令

    要用nodejs执行cmd,需要引入一个包node-cmd npm install node-cmd var cmd=require('node-cmd'); cmd.get( 'notepad',/ ...

随机推荐

  1. Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'blog.t_blog.addTime' which is not functi

    sql报错: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT ...

  2. [译文]Casperjs1.1.0参考文档-快速开始

    快速开始 只要casperjs被正确安装,你就可以开始写你的第一个脚本,你可以使用javascript或者coffiescript编译脚本. 提示: 如果你对javascript不是很熟悉,最好先看专 ...

  3. Jenkins持续集成企业实战系列之Jenkins手动构建-----04

    注:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.    最初接触Jenkins也是由于公司需求,根据公司需求Java代码项目升级的.(公司是 ...

  4. SDK 开发 .a .framework .bundle (xcode引用) 依赖sdk工程

    一. 静态库.a 1.创建静态库工程 Cocoa Touch Static Libray  ,然后可以创建一个测试视图 TestView 2.暴露头文件 -> Build Phases--> ...

  5. [CSU1911]Card Game(FWT)

    [vjudge-CSU1911] FWT_or #include<cstring> #include<iostream> #include<algorithm> # ...

  6. abp使用redis缓存

    利用NuGet程序包管理程序,添加 Abp.RedisCache 在 xxxx.Web.Core 项目的Module中注册Redis 在刚才上面这个类文件头部注册Redis组件 在Web.config ...

  7. POJ_1850 Code【组合的运用】

    题目: Transmitting and memorizing information is a task that requires different coding systems for the ...

  8. ul模拟select,位置,数据,是否可输入及输入提示效果都可作为参数直接传入

    转发请注明出处,虽然转发几率不大... HTML <span class="theContainer"></span> CSS body {padding: ...

  9. webstrom 搭建 nodejs

    1.安装好 nodejs .下载地址 http://nodejs.org/#download,一路next,位置自己定,直到完成. 2.安装好 webstorm.官网下载,破解方法很多,自己搜吧. 3 ...

  10. POJ - 2891 中国剩余定理

    \(mod\)存在不互素情况下的CRT #include<iostream> #include<algorithm> #include<cstdio> #inclu ...