【发布时间】:2018-09-18 00:49:32
【问题描述】:
当我运行命令 Enable-PSRemoting 时,我收到以下错误:
PS C:\Windows\system32> 启用-PSRemoting
WinRM Quick Configuration
Running command "Set-WSManQuickConfig" to enable remote management of this computer by using the Windows Remote
Management (WinRM) service.
This includes:
1. Starting or restarting (if already started) the WinRM service
2. Setting the WinRM service startup type to Automatic
3. Creating a listener to accept requests on any IP address
4. Enabling Windows Firewall inbound rule exceptions for WS-Management traffic (for http only).
Do you want to continue?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): a
WinRM is already set up to receive requests on this computer.
Set-WSManQuickConfig : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2"
Machine="localhost"><f:Message><f:ProviderFault provider="Config provider"
path="%systemroot%\system32\WsmSvc.dll"><f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault"
Code="2" Machine="my_laptop.ad.mydomain.com"><f:Message>Unable to check the status of the firewall.
</f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:69 char:17
+ Set-WSManQuickConfig -force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand
据我所知,当 PC 在公共网络上时,应该会发生此错误。这台 PC 不在公共网络上,而是加入了域。运行 Get-NetConnectionProfile 确认 DomainAuthenticated 网络状态。如何解决此问题并让 Enable-PSRemoting 正常运行?
我有一台运行 Powershell 4.0 的 Windows 8 PC。
【问题讨论】:
-
(Get-NetConnectionProfile).NetworkCategory返回什么?如果在Enable-PSRemoting上使用-Force参数会发生什么?你的会话提升了吗?错误消息反映了获取/设置防火墙规则的问题。 -
(Get-NetConnectionProfile).NetworkCategory 返回 DomainAuthenticated
-
我的会话被提升了,不管有没有 -Force 参数,结果都是一样的。
-
我也尝试关闭防火墙并在关闭的情况下运行命令,但没有任何区别。
-
您是否测试过该命令实际上失败了?你的防火墙启用了吗?你能验证规则是否到位?
Get-NetFirewallRule -All | ? Description -like '*5985*'
标签: windows powershell powershell-4.0 powershell-remoting