我使用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远程管理" -Service在远程PC上启动。
我完全在远程PC上完全禁用了防火墙以进行测试。
我也enable-psremoting
和Set-Item WSMan:\localhost\Client\TrustedHosts
*
当我在远程PC上执行时:
winrm config
它说:
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.
我还有什么其他的东西可以启用我可以使用PowerShell连接到我的远程PC?
更新
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
答案 0 :(得分:2)
从dir WSMan:\localhost\Shell\
输出中可以看到:
Type Name SourceOfValue Value
---- ---- ------------- -----
System.String AllowRemoteShellAccess GPO false
WS-Management配置属性AllowRemoteShellAccess
的值为false
,源为GPO
。这意味着:应用于目标计算机的组策略不允许远程shell访问。