加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

powershell远程处理Win2008R2“WSMan服务无法启动主机进程来处理

发布时间:2020-12-14 04:03:55 所属栏目:Windows 来源:网络整理
导读:我最近从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
我最近从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:localhostShell


   WSManConfig: Microsoft.WSMan.ManagementWSMan::localhostShell

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读