python远程连接windows_python winrm 连接windows
最近遇到项目需要使用windows 服务器,之前分开部署,先需求linux连接windows,使用winrm即可
一、配置windows winrm
1.运行如下,如果没有返回,则没有开启winrmPS C:\Users\Administrator> winrm enumerate winrm/config/listener
2.配置winrm基础配置PS C:\Users\Administrator> winrm quickconfig
已在此计算机上运行 WinRM 服务。
WinRM 没有设置成为了管理此计算机而允许对其进行远程访问。
必须进行以下更改:
在 HTTP://* 上创建 WinRM 侦听程序接受 WS-Man 对此机器上任意 IP 的请求。
配置 LocalAccountTokenFilterPolicy 以远程向本地用户授予管理权限。
执行这些更改吗[y/n]? y
WinRM 已经进行了更新,以用于远程管理。
在 HTTP://* 上创建 WinRM 侦听程序接受 WS-Man 对此机器上任意 IP 的请求。
已配置 LocalAccountTokenFilterPolicy 以远程向本地用户授予管理权限。
3. 查看windows的winrm service listenerPS C:\Users\Administrator> winrm e winrm/config/listener
Listener
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn = 127.0.0.1, 172.18.232.248, ::1, fe80::5efe:172.18.232.248%12, fe80::4963:ce66:e004:e54%17
4.配置winrm authPS C:\Users\Administrator> winrm set winrm/config/service/auth '@{Basic="true"}'
Auth
Basic = true
Kerberos = true
Negotiate = true
Certificate = false
CredSSP = false
CbtHardeningLevel = Relaxed
5.配置winrm service 加密方式为允许非加密PS C:\Users\Administrator> winrm set winrm/config/service '@{AllowUnencrypted="true"}'
Service
RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 1500
EnumerationTimeoutms = 240000
MaxConnections = 300
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = true
Auth
Basic = true
Kerberos = true
Negotiate = true
Certificate = false
CredSSP = false
CbtHardeningLevel = Relaxed
DefaultPorts
HTTP = 5985
HTTPS = 5986
IPv4Filter = *
IPv6Filter = *
EnableCompatibilityHttpListener = false
EnableCompatibilityHttpsListener = false
CertificateThumbprint
AllowRemoteAccess = true
二、在linux连接
1.python 脚#!/usr/bin/python
import winrm
win2008 = winrm.Session('http://11.22.33.44:5985/wsman',auth=('administrator','xxxx'))
r = win2008.run_cmd('cd .. & dir')
print r.std_out.decode()
print r.std_err
2.运行# python winP.py
Volume in drive C has no label.
Volume Serial Number is 50E1-E273
Directory of C:\Users
2018/07/10 10:10
2018/07/10 10:10
2018/07/06 08:57
2009/07/14 12:57
2018/07/11 18:21
0 File(s) 0 bytes
5 Dir(s) 252,649,209,856 bytes free
python远程连接windows_python winrm 连接windows相关推荐
- win连接被远程计算机终止,windows系统远程连接后马上断开提示“远程计算机已结束连接”的解决方法...
原标题:windows系统远程连接后马上断开提示"远程计算机已结束连接"的解决方法 此问题在远程系统是GHOST版的windowsxp和winserver2003时出现的比较普遍. ...
- python远程连接mysql数据库_python远程连接MySQL数据库
python远程连接MySQL数据库 本文实例为大家分享了python远程连接MySQL数据库的具体代码,供大家参考,具体内容如下 连接数据库 这里默认大家都已经配置安装好 MySQL 和 Pytho ...
- Windows远程桌面(xrdp+vnc)连接Ubu…
Windows远程桌面(xrdp+vnc)连接Ubuntu 分类: linux 2011-11-25 16:55 38人阅读 评论(0) 收藏 举报 Ubuntu自带了一个远程桌面,使用的是vpn模式 ...
- 远程计算机怎么连接腾讯云,使用 RDP 文件远程登录腾讯云Windows服务器的步骤
腾讯云Windows服务器连接登录除了通过电脑远程登录外,其实还有一种比较简单的方法,就是腾讯云官方推荐的远程登录Windows的方式,那就是通过使用 RDP 文件一键登录腾讯云Windows实例,下 ...
- 使用XShell、XFTP 连接 win7 虚拟机(windows、Linux无法远程登录问题)
文章目录 前言 出错原因 (题外话)那么我们为什么要使用 SSH 连接 开始操作(Windows7) 首先进行 SSH 测试 获取所需的openSSH文件 安装openSSH 添加环境变量 ssh测试 ...
- python远程ssh连接linux
python远程ssh连接linux 1.安装第三方库paramiko pip install paramiko 2.创建ssh客户端,并连接 ssh = paramiko.SSHClient()# ...
- 远程连接相关命令行(windows)
win +r 输入mstsc 然后加 MSTSC[<connection file>][/v:<server[:port]>][/g:<gateway>][/adm ...
- adb connect 远程adb连接手机无法连接,显示由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。(10060)windows调试Linux解决方式 ip连接方式
adb connect 远程adb连接手机无法连接,显示由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败.(10060) 解决方法 解决步骤 解决方法 解决目标前提 1.需要手机r ...
- python远程连接ssh_Python实现SSH连接远程服务器
首先需要安装paramiko模块 #-*- coding:utf-8 -*- __author__ = "MuT6 Sch01aR" import paramiko ssh = p ...
- python mysql ssh隧道_在python中使用ssh隧道连接mysql
通常为了保证数据库安全,不会允许直接连接数据库,而是需要通过SSH隧道去连接服务器背后的数据库: 今天我在用Python连接远程的MySQL时,直连遇到了无法连接的情况,使用了SSH隧道之后解决了问题 ...
最新文章
- 2022-2028年中国废矿物油行业市场研究及前瞻分析报告
- 编译安装PHP 时遇到问题解决方法.
- python3读取excel数据-Python3将爬取的数据存储到Excel
- linux生成公钥实现ssh,linux下生成 SSH 公钥,用于GitHub
- 前端学习(2734):重读vue电商网站44之使用 echarts
- SQLSERVER中SP_WHO2和INPUTBUFFER的用法
- Spring源代码分析-Persist--JdbcTemplate
- linux双括号文本比较,Linux Shell 双括号运算符使用
- 使用cURL操作Openstack对象存储的ReST API
- 一道面试题:用多线程求1000以内的素数有多少个?并给出消耗时间
- 基于kubectl实现红队K8S模拟对抗
- maya python 游戏与影视编程指南_Maya Python游戏与影视编程指南
- 1976国际标准大气模型_Matlab
- 起点中文网月票榜爬取及数据分析
- 武汉高中计算机网络技术分数线,2021年武汉高中录取分数线排名公布
- 还在用Windows虚拟机?快来试试Windows自带的Sandbox吧!
- Windows Server 2019的安装模式
- 台式计算机软件打不开,电脑打开软件显示乱码的解决方法 电脑点击软件没反应怎么办...
- 哲学家进餐_我如何通过预算学习计划进餐
- element中el-dialog组件垂直居中完美解决方案,适配超高dialog
热门文章
- Error: PostCSS received undefined instead of CSS string核心解决方法
- centos7 vi保存退出_vi保存退出命令 - 卡饭网
- 软件测试计划和测试方案区别
- css 识别屏幕大小自适应
- 腾讯云cdn设置 php,腾讯云CDN缓存过期配置问题详解
- leetcode【链表—中等】707.设计链表
- CCS错误解决:#10247-D null: creating output section “ramfuncs“ without a SECTIONS specification
- Apache 报错指定的网络名不再可用解决方案
- 项目经理要“谋定而后动,知止而有得,万事皆有法,不可乱也”
- SpringBoot全局异常处理(三十)