PowerShell 是否存在导致错误 Not enough quota is available to process this command 的限制? [英] Does PowerShell have a limit that causes the error Not enough quota is available to process this command?

查看:26
本文介绍了PowerShell 是否存在导致错误 Not enough quota is available to process this command 的限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个部署脚本失败并显示错误消息:没有足够的配额来处理此命令.

We have a deployment script that is failing with the error message: Not enough quota is available to process this command.

在它失败时,它会在已经启动同一个可执行文件 10 次之后尝试异步启动一个可执行文件.所以11号失败了.一共需要启动17个.此脚本不是用 PowerShell 编写的,但我们使用远程 PowerShell 会话来启动它,只有在我们通过 PowerShell 远程处理运行脚本时才会发生此错误.

At the point where it fails it is attempting to start an executable asynchronously after having already started the same executable 10 times. So number 11 fails. A total of 17 need to be started. This script is not written in PowerShell but we use a remote PowerShell session to launch it and this error only happens when we run the script via PowerShell remoting.

如果我们在不使用 PowerShell 远程处理的情况下直接在服务器上运行相同的脚本,我们就不会收到此错误,并且该脚本在启动 exe 的所有实例(总共 17 个)并且没有错误地完成时没有问题.

If we run the same script directly on the server without using PowerShell remoting we don't get this error and the script has no problem launching all instances of the exe (17 in total) and finishing without error.

我检查了我怀疑可能是错误原因的典型 WSMAN 限制,据我所知,它们被设置为无限制.起初我以为 MaxProcessesPerShell 可能设置得太低了.以下是运行它的服务器上 WSMAN 驱动器的结果:

I have checked on the typical WSMAN limits that I suspected might be the cause of the error and they are set to unlimited as far as I can tell. At first I thought maybe MaxProcessesPerShell was set too low. Here are the results from the WSMAN drive on the server where this is running:

我们目前有这些 WSMAN 设置:

We have these WSMAN settings currently:

> WSMan:\localhost\Shell> dir

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

Type            Name                           SourceOfValue   Value
----            ----                           -------------   -----
System.String   AllowRemoteShellAccess                         true
System.String   IdleTimeout                                    7200000
System.String   MaxConcurrentUsers                             2147483647
System.String   MaxShellRunTime                                2147483647
System.String   MaxProcessesPerShell                           2147483647
System.String   MaxMemoryPerShellMB                            2147483647
System.String   MaxShellsPerUser                               2147483647

是否有任何其他 PowerShell 或 WSMAN 设置可能导致此错误?

Is there any other PowerShell or WSMAN setting that might be the cause of this error?

针对配额不足... 错误推荐的典型解决方案涉及增大页面文件.我还没有尝试过,因为脚本在 PowerShell 会话之外运行没有错误.

The typical solution that is recommended for the Not enough quota... error involves making the Page file bigger. I have not tried that yet because the script runs error free outside of a PowerShell session.

如果需要帮助回答这个问题,我可以提供关于我们的脚本正在做什么的更多细节.

I can provide more specifics about what our script is doing if that is needed to help answer this question.

推荐答案

导致我出错的配额限制是 PowerShell 32 位插件上的 MaxProcessesPerShell 设置.此设置独立于外壳设置.为了解决这个问题,我在远程 PowerShell 会话中运行了以下命令...

The quota limit that was causing my error was the MaxProcessesPerShell setting on the PowerShell 32 bit plugin. This setting is independent of the Shell setting. To fix the issue I ran the follow commands in the remote PowerShell session...

 dir WSMan:\localhost\Plugin\microsoft.powershell32\Quotas\MaxProcessesPerShell

结果...

Type            Name                           SourceOfValue   Value
----            ----                           -------------   -----
System.String   MaxProcessesPerShell                           15

使用...将设置更改为 25

Change the setting to 25 with...

Set-Item WSMan:\localhost\Plugin\microsoft.powershell32\Quotas\MaxProcessesPerShell 25

使用...重新启动 WinRM 服务

Restart the WinRM service with...

Restart-Service WinRM

尝试在此新配额生效的情况下再次运行有问题的脚本,现在它可以启动所有 17 个 exe 实例而没有任何错误.还有一个 64 位 PowerShell 插件,它也有自己的设置.

Tried running the problem script again with this new quota in effect and it now launches all 17 instances of the exe without any error. There is also a 64 bit PowerShell plugin which has it's own setting for this too.

在此处找到此解决方案 没有足够的配额来处理此命令

This solution was found here Not enough quota is available to process this command

这篇关于PowerShell 是否存在导致错误 Not enough quota is available to process this command 的限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆