我使用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-psremoting
和Set-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