windows WinRM连接问题?

58wvjzkj  于 2023-02-05  发布在  Windows
关注(0)|答案(1)|浏览(259)

我正在尝试将Enter-PSSession与公司网络中的公司服务器连接。我可以使用Get-Service -ComputerName DBServer RDC连接到服务器、ping服务器并获取Windows服务状态。但是,WinRM会话不允许我访问服务器。
我的电脑:

  • windows 10
  • Powershell 5.0
  • IP地址:www.example.com128.2.60.102

服务器:

  • Windows服务器2012
  • PowerShell 4.0
  • IP地址:www.example.com10.1.130.1

在数据库服务器上:

PS C:\Windows\system32> **winrm e winrm/config/listerner**
WSManFault
    Message
        ProviderFault
            WSManFault
                Message = The WS-Management service cannot process the
                          request. The resource URI does not support the
                          Enumerate operation.

Error number:  -2144108495 0x80338031
The WS-Management service cannot process the request because the WS-
Addressing Action URI in the request is not compatible with the resource.

PS C:\Windows\system32> **winrm quickconfig**
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.

PS C:\Windows\system32> **winrm get winrm/config**
Config
    MaxEnvelopeSizekb = 500
    MaxTimeoutms = 60000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
    Client
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = false
        Auth
            Basic = true
            Digest = true
            Kerberos = true
            Negotiate = true
            Certificate = true
            CredSSP = false
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        TrustedHosts
    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 = false
        Auth
            Basic = false
            Kerberos = true
            Negotiate = true
            Certificate = false
            CredSSP = false
            CbtHardeningLevel = Relaxed
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        IPv4Filter = *
        IPv6Filter = *
        EnableCompatibilityHttpListener = false
        EnableCompatibilityHttpsListener = false
        CertificateThumbprint
        AllowRemoteAccess = true
    Winrs
        AllowRemoteShellAccess = true
        IdleTimeout = 7200000
        MaxConcurrentUsers = 10
        MaxShellRunTime = 2147483647
        MaxProcessesPerShell = 25
        MaxMemoryPerShellMB = 1024
        MaxShellsPerUser = 30

在客户端(我的计算机)上:

PS C:\windows\system32> **Test-WSMan -ComputerName "DBServer"**
Test-WSMan : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/
1/wsmanfault" Code="2150859046" Machine="MyMachine"><f:Message>WinRM cannot
complete the operation. Verify that the specified computer name is valid, that
the computer is accessible over the network, and that a firewall exception for
the WinRM service is enabled and allows access from this computer. By default,
the WinRM firewall exception for public profiles limits access to remote
computers within the same local subnet. </f:Message></f:WSManFault>
At line:1 char:1
+ Test-WSMan -ComputerName "DBServer"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (DBServer:String) [Test-WSMan], InvalidOperationException
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.TestWSManCommand

PS C:\windows\system32> **winrm e winrm/config/listener**
Listener
    Address = *
    Transport = HTTP
    Port = 5985
    Hostname
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint
    ListeningOn = 127.0.0.1, 128.1.60.202, ::1

PS C:\windows\system32> winrm quickconfig
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.

WinRM的防火墙端口对HTTP和HTTPS都是开放的。
有人能帮助解决这个问题吗?

6jjcrrmo

6jjcrrmo1#

注意:以下内容可能不是问题的根本原因,但它解释了您在 * server * 上看到的错误消息,该消息含义模糊,值得解释(一个简单的拼写错误也让我感到困惑,并导致我来到这里)。

    • 您传递给服务器上winrm e的资源URI**中有 * 拼写错误 *:
winrm e winrm/config/listerner  # note the extra "r"

应为:

winrm e winrm/config/listener

遗憾的是,**对 * 不存在的资源URI * 的引用会导致以下 * 神秘的错误消息 *:

WSManFault
    Message
        ProviderFault
            WSManFault
                Message = The WS-Management service cannot process the request. The resource URI does not support the Enumerate operation.

Error number:  -2144108495 0x80338031
The WS-Management service cannot process the request because the WS-Addressing Action URI in the request is not compatible with the resource.

相关问题