无法通过winrm窗体NT NT 6.2获取命令输出 [英] Couldn't get command output via winrm form windows NT 6.2.x

查看:127
本文介绍了无法通过winrm窗体NT NT 6.2获取命令输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过winrm运行组合命令(例如cd c:\&& dir)。我使用HttpClien发送xml格式请求,而winrm和返回200表示命令正在运行。

I try to run combination commands (such as cd c:\ && dir) via winrm. I use the HttpClien to send xml format request, and the winrm and return 200 said the command running.

然后我尝试使用xml请求下面的命令输出:

And then I try to get the command output by use below xml request:

<s:Envelope xmlns:s='http://www.w3.org/2003/05/soap-envelope' xmlns:a='http://schemas.xmlsoap.org/ws/2004/08/addressing'
            xmlns:w='http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'
            xmlns:sh='http://schemas.microsoft.com/wbem/wsman/1/windows/shell'>
    <s:Header>
        <a:To>http://10.154.10.132:5985/wsman</a:To>
        <w:ResourceURI s:mustUnderstand='true'>http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd
        </w:ResourceURI>
        <a:ReplyTo>
            <a:Address s:mustUnderstand='true'>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
            </a:Address>
        </a:ReplyTo>
        <a:Action s:mustUnderstand='true'>http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive</a:Action>
        <w:MaxEnvelopeSize s:mustUnderstand='true'>1048576</w:MaxEnvelopeSize>
        <a:MessageID>uuid:E83DE0D9-032A-4AB6-8BA7-0A6A1EC6E56D</a:MessageID>
        <w:Locale xml:lang='en_US' s:mustUnderstand='false'/>
        <w:SelectorSet>
            <w:Selector Name='ShellId'>BEF0F020-0647-49C5-9198-8525AD1EC06E</w:Selector>
        </w:SelectorSet>
        <w:OperationTimeout>PT27S</w:OperationTimeout>
    </s:Header>
    <s:Body>
        <sh:Receive SequenceId='0'>
            <sh:DesiredStream CommandId='9F27A1D9-6870-4AA0-971D-B6CE18514E38'>stdout stderr</sh:DesiredStream>
        </sh:Receive>
    </s:Body>
</s:Envelope>

winrm服务返回此请求的空结果..如果我尝试一个独立的命令,例如'dir c:\ ',winrm可以正常返回。

The winrm service return empty result for this request.. If I try a standalone comman such as 'dir c:\', the winrm can return normally.

但是当在win7或win2008中尝试上述操作时,它可以返回命令(无论是组合还是独立)输出结果如预期。

But when try above actions in win7 or win2008, it can return command (Not matter combination  or standalone) output result as expect.

IAre是否还能遇到这个问题?我无法通过搜索关键词winrm,winrs找到任何消息....


IAre anyother meet this issue? I cann't find any message by searching keyword winrm, winrs....

推荐答案

嗨gavin.luo,

Hi gavin.luo,

感谢您在此处发帖。

>> winrm服务返回此结果为空请求..如果我尝试使用'dir c:\'之类的独立命令,winrm可以正常返回。

但是当在win7中尝试上述操作时或win2008,它可以按预期返回命令(无论是组合或独立)输出结果。

IAre是否还能遇到此问题?通过搜索关键字winrm,winrs找不到任何消息....

您是否收到了winrm服务返回的任何错误消息?您是否尝试发送

Have you got any error messages returned by winrm service? Have you tried to send


LASTEXITCODE命令以获取最后一个退出代码?
LASTEXITCODE command to get the last exit code?

对于这种情况,您还可以尝试使用PowerShell发送winrm命令查看是否有任何错误消息返回。

For this case, you could also try to use PowerShell to send winrm command to see if there has any error messages returned.

https: //technet.microsoft.com/en-us/library/ff700227.aspx

如果你想发布一个bug,你可以
连接到Microsoft并在其上发布此问题。

If you want to post a bug, you could connect to Microsoft and post this issue on it.

您的理解与合作将不胜感激。

Your understanding and cooperation will be grateful.

最诚挚的问候,

Baron Bi


这篇关于无法通过winrm窗体NT NT 6.2获取命令输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆