gpt4 book ai didi

powershell - 无法使用powershell连接到远程电脑

转载 作者:行者123 更新时间:2023-12-02 12:40:01 24 4
gpt4 key购买 nike

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

为了实现此目的,我根据此视频在两台计算机上进行了一些配置:

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

但是当我尝试在本地计算机上执行此操作时,我仍然收到错误消息:

enter-pssession -comp remotePC -credential domain\username

然后我输入密码并按 Enter 键。

我收到此错误:

连接到远程服务器 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 远程管理”服务在远程 PC 上启动。

出于测试目的,我在远程 PC 上完全禁用了防火墙。

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

当我在远程PC上执行时:

winrm 配置 它说:

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\ 输出中看到的:

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

WS-Management 配置属性 AllowRemoteShellAccess 的值为 false 以及源 GPO。这意味着:应用于目标计算机的组策略不允许远程 shell 访问。

关于powershell - 无法使用powershell连接到远程电脑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35847295/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com