Test-WSMan使用Powershell失败

时间:2019-06-07 03:27:33

标签: powershell rdp

PS C:\Windows\system32> Test-WSMan x.x.xx.x
Test-WSMan : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="995" Machine="desktop-12"><f:Message>WS-Management cannot process the request. The operation
failed because of an HTTP error. The HTTP error (12152) is: The server returned an invalid or unrecognized response . </f:Message></f:WSManFault>
At line:1 char:1
+ Test-WSMan x.x.xx.x
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (x.x.xx.x:String) [Test-WSMan], InvalidOperationException
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.TestWSManCommand

我仅从此笔记本电脑无法执行命令。 RDP连接在此笔记本电脑上成功。 下面是一些命令的输出

PS C:\Windows\system32> winrm get winrm/config/service/auth
Auth
    Basic = false
    Kerberos = true
    Negotiate = true
    Certificate = false
    CredSSP = false
    CbtHardeningLevel = Relaxed

PS C:\Windows\system32> Get-NetConnectionProfile

Name             : Unidentified network
InterfaceAlias   : Ethernet 2
InterfaceIndex   : 8
NetworkCategory  : Public
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Name             : K32806
InterfaceAlias   : Wi-Fi
InterfaceIndex   : 17
NetworkCategory  : Public
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

PS C:\Windows\system32> Get-Item wsman:\localhost\client\trustedhosts

   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client

Type            Name                           SourceOfValue   Value
----            ----                           -------------   -----
System.String   TrustedHosts                                   x.x.xx.x

我启用了Enable-PSRemoting -force,Restart-Service WinRM并尝试了Test-WSMan,但没有成功。请帮助我解决此问题。

1 个答案:

答案 0 :(得分:1)

  1. 如果需要通过主机vpn连接,请确保您的主机可以从本地计算机访问,并且不在私有网络中。
  2. 验证主机IP是否正确