我正在创建一个在远程服务器上使用多个“Invoke-Command -asjob”的脚本,但在测试 While-Loop 时我不得不停止它。但是,当我现在在目标服务器上尝试 Invoke-Command -asjob 时,它返回状态为 failed 的作业。当我收到作业时,它返回此错误:
The WS-Management service cannot process the request. This user has exceeded the maximum number of concurrent shells allowed for this plugin. Close at least one open shell or raise the plugin quota for this user.
+ FullyQualifiedErrorId : -2144108060,PSSessionStateBroken
Run Code Online (Sandbox Code Playgroud)
当我执行 Get-PSSession 时,没有列出,所以我不能使用 Remove-PSSession(这是 Google 迄今为止唯一的建议)。
这是它基本上执行的内容:
While ($True)
{
Invoke-Command -Computername $RemoteServer -AsJob {Get-ChildItem}
}
Run Code Online (Sandbox Code Playgroud)
我打破了它并做了Get-Job | Remove-Job 删除了所有作业,但我仍然无法在远程服务器上启动 Invoke-Command -AsJob。
我还在远程服务器上重新启动了 WSMAN 服务(通过使用 RDP 登录),但它不起作用。
powershell ×1