如何使用命令行创建WinRM Shell?

时间:2019-04-14 04:08:56

标签: winrm

WinRM命令行允许通过键入新的Shell命令实例

winrm create -?

示例:从xml创建Windows Shell命令实例:   winrm创建shell / cmd -file:shell.xml -remote:srv.corp.com

但是,我找不到有关如何形成上述shell.xml文件作为创建新Shell的输入的适当文档。我想使用的一些示例选项:

Shell实例参数

  • OperationTimeout“ PT9999S”
  • “ en-US”语言环境
  • InputStreams“ stdin”
  • OutputStreams“ stdout stderr”

Shell选项

  • WINRS_NOPROFILE = FALSE
  • WINRS_CODEPAGE = 65001

我还设法捕获了WinRM协议的TCP数据包,该数据包可能会导出shell.xml的格式

<?xml version="1.0" encoding="utf-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:b="http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd" xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cfg="http://schemas.microsoft.com/wbem/wsman/1/config" xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><env:Header><w:OperationTimeout>PT9999S</w:OperationTimeout><a:To>http://windows-host:5985/wsman</a:To><w:OptionSet><w:Option Name="WINRS_NOPROFILE">FALSE</w:Option><w:Option Name="WINRS_CODEPAGE">65001</w:Option></w:OptionSet><w:MaxEnvelopeSize mustUnderstand="true">153600</w:MaxEnvelopeSize><w:ResourceURI mustUnderstand="true">http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI><a:Action mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><p:DataLocale mustUnderstand="false" xml:lang="en-US"></p:DataLocale><a:ReplyTo><a:Address mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><a:MessageID>uuid:a9b8312c-2d01-4757-9ef2-9751ddaafd43</a:MessageID><w:Locale mustUnderstand="false" xml:lang="en-US"></w:Locale></env:Header><env:Body><rsp:Shell><rsp:InputStreams>stdin</rsp:InputStreams><rsp:OutputStreams>stdout stderr</rsp:OutputStreams></rsp:Shell></env:Body></env:Envelope>

有人以前这样做过吗?非常感谢您的帮助。谢谢。

0 个答案:

没有答案
相关问题