powershell远程处理Win2008R2“WSMan服务无法启动主机进程来处理给定的请求”

前端之家收集整理的这篇文章主要介绍了powershell远程处理Win2008R2“WSMan服务无法启动主机进程来处理给定的请求”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我最近从2003年到2008年升级了许多服务器.自升级以来,我开始看到以下错误

[servername] Connecting to remote server Failed with the following error message : The WSMan service could not launch a host process to process the given request. Make sure the WSMan provider host server and proxy are properly registered. For more information,see the about_Remote_Troubleshooting Help topic.

错误似乎是随机的.该脚本将工作,然后失败.创建会话的命令处于循环中(创建会话,删除会话),并作为一组部署脚本的一部分被多次调用.当脚本失败时,它会在不同的点失败.

我检查了本地工作站(win7)目标服务器(win2008R2)上的事件日志,但没有我能看到的错误.

这是随机失败的行:

$session = New-PSSession -ComputerName $serverName -Credential $credential

我在Win2003上没有看到这个问题.脚本没有改变.我假设问题出在目标服​​务器上,但找不到任何错误或日志要查看.它将工作一次然后失败,因此我的部署脚本有时会成功,然后在不同的点失败.

任何有关追踪此问题的指导都将非常感激.

您是否通过创建崩溃并使进程保持打开状态的pssessions来达到进程限制的数量

默认限制为15.我同意上述注释而不使用会话,而是使用invoke-command,如:

invoke-command -scriptblock $scriptBlock -ArgumentList $args -computername $compName -Credential $encodedRemoteCredentials

检查你的限制:

PS C:\aws> ls WSMan:\localhost\Shell


   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Shell

Name                      Value
----                      ----
MaxProcessesPerShell      15

作为快速而肮脏的测试 – 下次您的pssession版本的脚本失败时,使用set-item cmdlet将maxProcessesPerShell限制增加到50并重试.如果脚本不再失败,您知道这是问题(并且应该考虑转移到invoke-command!).

原文链接:https://www.f2er.com/windows/365062.html

猜你在找的Windows相关文章