无法使用PowerShell连接远程电脑

3

我使用PowerShell从一台计算机连接到另一台远程计算机。

为了使其工作,我根据此视频对两台计算机进行了一些配置:

https://technet.microsoft.com/en-us/itmanagement/ff765030.aspx

但仍然在本地计算机上尝试时收到错误消息:

enter-pssession -comp remotePC -credential domain\username

然后我输入密码并按回车键。

我收到了以下错误信息:

连接到远程服务器LocalPC失败,出现以下错误信息:

 The WS-Management service cannot process the request. The 
service is configured to not accept any remote shell requests. For more 
CategoryInfo : OpenError: (LocalPC:String) [], PSRemotingTrans
portException + FullyQualifiedErrorId : RemoteSessionDisallowed,PSSessionStateBroken

远程计算机上启动了“Windows远程管理”服务。

为了测试目的,我完全禁用了远程计算机上的防火墙。

我还执行了enable-psremotingSet-Item WSMan:\localhost\Client\TrustedHosts*

当我在远程计算机上执行以下命令:

winrm config 它会显示:

WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.

我还需要启用哪些其他1000个功能,才能使用PowerShell连接到我的远程电脑?

更新

PS C:\Windows\system32> winrm get winrm/config/service

Service
    RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;
    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


PS C:\Windows\system32> winrm e winrm/config/listener

Listener
    Address = *
    Transport = HTTP
    Port = 5985
    Hostname
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint
    ListeningOn = xx.xx.xx.xx, 127.0.0.1, ::1, fe80::4c2c:a8d0:6046:764d%11

更新2

PS C:\Windows\system32> dir WSMan:\localhost\Shell\


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

Type            Name                           SourceOfValue   Value
----            ----                           -------------   -----
System.String   AllowRemoteShellAccess         GPO             false
System.String   IdleTimeout                                    7200000
System.String   MaxConcurrentUsers                             10
System.String   MaxShellRunTime                                2147483647
System.String   MaxProcessesPerShell                           25
System.String   MaxMemoryPerShellMB                            1024
System.String   MaxShellsPerUser                               30

那么 dir WSMan:\localhost\Shell\ 怎么样? - user4003407
请参见我的回答@PetSerAl,更新2。 - Elisabeth
2
正如您所看到的:“System.String AllowRemoteShellAccess GPO false” - 您的组策略不允许远程 shell 访问。 - user4003407
1个回答

1

dir WSMan:\localhost\Shell\ 的输出可以看出:

Type            Name                           SourceOfValue   Value
----            ----                           -------------   -----
System.String   AllowRemoteShellAccess         GPO             false

WS-Management配置属性AllowRemoteShellAccess的值为false,源自GPO。这意味着:应用于目标计算机的组策略禁止远程Shell访问。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接