gpt4 book ai didi

powershell 远程处理 Win2008R2 "The WSMan service could not launch a host process to process the given request"

转载 作者:行者123 更新时间:2023-12-04 08:55:59 25 4
gpt4 key购买 nike

我最近将一些服务器从 2003 升级到 2008R2。自从升级以来,我开始看到以下错误:

[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.



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

我已经检查了本地工作站 (win7) 目标服务器 (win2008R2) 上的事件日志,但是我看不到任何错误。

这是随机失败的行:

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



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

任何有关追踪此问题的指导将不胜感激。

最佳答案

您需要设置 WSMan TrustedHosts。如果需要,您可以使用通配符 (*) 将其设置为所有内容。

您可以通过 PowerShell 执行此操作:Set-Item WSMan:\localhost\Client\TrustedHosts -Value * .

请记住,您还需要启用 Windows 远程服务。使用原生winrm qc为此命令。 Enable-PSRemoting -Force也可以这样做。

您还可以使用 Sysinternals 的 PSExec 工具。请记住,这些工具可能会被 EndPoint Security 阻止,因此不要忘记将其列入白名单。

您是否有特定原因将旧操作系统迁移到更新但仍处于 EOL 的操作系统上?您可以在 2008R2 中通过 PowerShell 做很多事情,但它仍然非常有限。 IMO,最好从 2012R2 开始使用 PowerShell。

关于powershell 远程处理 Win2008R2 "The WSMan service could not launch a host process to process the given request",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8748173/

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