WinRM 即 Windows Remote Management,是微软对于WS-Management 远程管理协议的实现。
一、受控端配置 WinRM 服务
方式一:cmd 命令行(管理员)
- 启用 WinRM 远程服务:
winrm quickconfig
- 查看 WinRM 服务监听状态:
winrm e winrm/config/listener
C:\Windows\system32>winrm e winrm/config/listener Listener [Source="GPO"] Address = * Transport = HTTP Port = 5985 Hostname Enabled = true URLPrefix = wsman CertificateThumbprint ListeningOn = 127.0.0.1, 169.254.52.7, xx.xx.xx.xx, ::1, fe80::3989:dd91:e6b3:6f41%15, fe80::fd01:a9fd:c410:3407%12
允许使用 Basic 认证方式: winrm set winrm/config/service/auth @{Basic="true"}
winrm set winrm/config/service/auth @{Basic="true"} Auth Basic = true [Source="GPO"] Kerberos = true Negotiate = true Certificate = false CredSSP = false CbtHardeningLevel = Relaxed
允许 WinRM 使用非加密的连接: winrm set winrm/config/service @{AllowUnencrypted="true"}
方式二:bat 脚本
call winrm quickconfig -quiet call winrm set winrm/config/service/auth @{Basic="true"} call winrm set winrm/config/service @{AllowUnencrypted="true"}
方式三:组策略
定位到 计算机配置 -> 策略 -> 管理模板 -> Windows 组件 -> Windows 远程管理(WinRM) -> WinRM 服务 。
启用 允许通过 WinRM 进行远程服务器管理 、 允许基本身份验证 、 允许未加密通信 。
建议同时启用服务与防火墙策略:
计算机配置-> 策略 -> Windows 设置 -> 安全设置 -> 系统服务 -> Windows Remote Management (WS-Management) ,启动模式为自动。
计算机配置-> 策略 -> Windows 设置 -> 安全设置 -> 高级安全 Windows 防火墙 -> 高级安全 Windows 防火墙 - XXX -> 入站规则 ,开放 5985(HTTP)和 5986(HTTPS)端口。
二、Python 使用 pywinrm 连接 WinRM 服务
安装 pywinrm 库: pip install pywinrm
执行 cmd 命令:
> import winrm > session = winrm.Session('xx.xx.xx.xx', auth=('Administrator', 'admin_password')) > cmd = session.run_cmd('ipconfig') > cmd.std_out b'\r\nWindows IP Configuration\r\n\r\n\r\nEthernet adapter \xd2\xd4\xcc\xab\xcd\xf8:\r\n\r\n Connection-specific DNS Suffix . : example.com\r\n Link-local IPv6 Address . . . . . : fe80::3989:dd91:e6b3:6f41%15\r\n IPv4 Address. . . . . . . . . . . : xx.xx.xx.xx\r\n Subnet Mask . . . . . . . . . . . : 255.255.255.0\r\n Default Gateway . . . . . . . . . : 172.20.23.254\r\n\r\nEthernet adapter \xd2\xd4\xcc\xab\xcd\xf8 2:\r\n\r\n Media State . . . . . . . . . . . : Media disconnected\r\n Connection-specific DNS Suffix . : \r\n'
执行 Powershell 命令:
> import winrm > session = winrm.Session('xx.xx.xx.xx', auth=('Administrator', 'admin_password')) > ps = session.run_ps('Get-Disk') > ps.std_out b'\r\nNumber Friendly Name Serial Number HealthStatus OperationalStatus Total Size Partition \r\n Style \r\n------ ------------- ------------- ------------ ----------------- ---------- ----------\r\n0 ST500DM002... Z3TFS1S3 Healthy Online 465.76 GB MBR \r\n\r\n\r\n'
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 群星.1995-烧得厉害VOL.4两个世界【滚石】【WAV+CUE】
- 归龙潮中浦城区宝箱位置收集大全 中浦区宝箱解密攻略
- 黑神话悟空上品幽灯鬼精魄获取方法一览|上品幽灯鬼精魄收集攻略
- 《电锯糖心:RePOP》发售首日表现亮眼,玩家峰值超越《星鸣特攻》
- NewViennaOctet,ViennaWindSoloists-TheDeccaRecordings(2024)18CD[FLAC]-8
- 金梅子-《靓声妹3又见炊烟》[WAV+CUE]
- 杨阳《约定HQCDII》头版限量编号2024[WAV+CUE]
- 曝《黑神话:悟空》DLC明年推出 农历新年前后
- PS5日本涨价19% 索尼股价应声上涨2.7%
- 《黑神话》发行平台遭大规模网攻 外媒却鲜有报道
- 伍佰《爱你伍佰年 世纪典藏原音精选3CD》[WAV+CUE][2.3GB]
- 伍佰《爱情的尽头》[WAV+CUE][2.6GB]
- 伍佰 《光环摇滚之声DSD》[WAV+CUE][500MB]
- 王菲.1999-只爱陌生人【EMI百代】【WAV+CUE】
- 林美音.1993-酒后的心声【瑞华】【WAV+CUE】