[英]How to enable powershell remoting in Powershell V3?
I'm running powershell 3.0 in Windows 7 and I'm connected to a domain.我在 Windows 7 中运行 powershell 3.0 并且我已连接到域。
These are the logs I get when I run Enable-PSRemoting:这些是我运行 Enable-PSRemoting 时得到的日志:
WinRM has been updated to receive requests.
WinRM service type changed successfully.
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="mycomputername.mydomainname"><f:Message>Unable to check the sta
the firewall. </f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:1 char:1
+ Set-WSManQuickConfig
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand
Oops...in my Inbound Rules of the Firewall settings, the Windows Remote Management(HTTP-In) Rule was not added.糟糕...在我的防火墙设置的入站规则中,没有添加 Windows 远程管理(HTTP-In)规则。 I added it and the issue got resolved.
我添加了它,问题得到了解决。 So, make sure you have all the inbound rules configured for the WinRM(Http-In) in the Firewall settings
因此,请确保在防火墙设置中为 WinRM(Http-In) 配置了所有入站规则
To add to a4aravind's answer,添加到a4aravind的答案,
I was experiencing a similar problem in a Server 2k12 Core environment, but simply adding the firewall rules didn't help.我在 Server 2k12 Core 环境中遇到了类似的问题,但简单地添加防火墙规则并没有帮助。 In my case, the machines that were playing up were on a domain (or had recently been in a domain).
就我而言,正在播放的机器在域中(或最近在域中)。 I found that I had to do the following:
我发现我必须执行以下操作:
Having made these changes I was able to run Enable-PSRemoting, and then gpupdate to reapply the domain firewall rules.进行这些更改后,我可以运行 Enable-PSRemoting,然后使用 gpupdate 重新应用域防火墙规则。
Hopefully that'll help someone in a similar situation.希望这会帮助处于类似情况的人。 A similar error message that I had on some of the machines was "Unable to enable the firewall for WinRM".
我在某些机器上遇到的类似错误消息是“无法为 WinRM 启用防火墙”。 I believe this was caused by group policy, and occurs when the message "For your security, some settings are controlled by Group Policy" is shown.
我相信这是由组策略引起的,并且在显示消息“为了您的安全,某些设置由组策略控制”时会发生。
Note: In my case, the affected servers had all been built from an image that had previously been joined to the domain and picked up some dodgy GPO policies which messed up WinRM, before being removed from the domain and then added to our catalog.注意:在我的例子中,受影响的服务器都是从一个先前加入域的映像构建的,并在从域中删除然后添加到我们的目录之前,选择了一些搞砸了 WinRM 的狡猾的 GPO 策略。 Which goes to show that you should check your images before pushing out a few dozen server images.
这表明您应该在推出几十个服务器镜像之前检查您的镜像。
就我而言,重新启动 Windows 防火墙服务完成了这项工作。
In my case I had to add both "normal" rules as well as "compatiblity" rules:就我而言,我必须同时添加“正常”规则和“兼容性”规则:
Windows Remote Management - Compatibility Mode (HTTP-In)
Windows Remote Management (HTTP-In)
This are 4 rules in total.这总共是4条规则。
Next step is to set Remote Address
fields to Any
for Public profile rules.下一步是将
Remote Address
字段设置为Any
公共配置文件规则。
That did the trick, I can now modify all WinRM
settings.这样就成功了,我现在可以修改所有
WinRM
设置。
If the effect is not immediate, then select all 4 rules, disable them and enable again, then restart WinRM
service.如果效果不是立竿见影的,那就把4条规则全选,禁用再启用,然后重启
WinRM
服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.