由于内存常量导致Powershell崩溃

我有一台运行大约500个Power
Shell进程的服务器.这些过程中的每一个都旨在通过我们的环境进行WMI调用.我一直小心地确认我没有用尽所有服务器的可用内存或CPU.当我运行所有500个进程时,我的内存使用率约为70%.

如果有人想知道如何处理各个流程,他们就会使用齿轮工作者来执行.基本上是一个调用powershell脚本的shell python脚本…时间500.

我遇到的问题是我的一些PowerShell进程在运行几个小时后崩溃了.

我得到的一些错误是:

A new guard page for the stack cannot be created

当我打开事件查看器时,我会在进程崩溃时看到这些事件

Fault bucket , type 0
Event Name: PowerShell
Response: Not available
Cab Id: 0

Problem signature:
P1: powershell.exe
P2: 6.3.9600.16394
P3: System.OutOfMemoryException
P4: System.OutOfMemoryException
P5: oft.PowerShell.ConsoleHost.ReportExceptionFallback
P6: lization.EncodingTable.nativeCreateOpenFileMapping
P7: Consol.. main thread
P8: 
P9: 
P10: 

Attached files:

These files may be available here:
C:\path

Analysis symbol: 
Rechecking for solution: 0
Report Id: ID
Report Status: 2048
Hashed bucket:

我猜它与PowerShell耗尽内存有关,但是服务器没有达到峰值,并且并非所有进程都崩溃,而是零星的.

任何帮助,将不胜感激.

以下是更多崩溃结果,powershell故障模块名称不时有所不同:

  Problem Event Name:   APPCRASH
  Application Name: powershell.exe
  Application Version:  6.3.9600.16384
  Application Timestamp:    52158733
  Fault Module Name:    ntdll.dll
  Fault Module Version: 6.3.9600.16408
  Fault Module Timestamp:   523d45fa
  Exception Code:   c00000fd
  Exception Offset: 00069abb
  OS Version:   6.3.9600.2.0.0.272.7
  Locale ID:    1033
  Additional Information 1: 624b
  Additional Information 2: 624b484d3cf74536f98239c741379147
  Additional Information 3: a901
  Additional Information 4: a901f876e92d1eb79eb3a513defef0c6

  Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: powershell.exe
  Application Version:  6.3.9600.16384
  Application Timestamp:    52158733
  Fault Module Name:    combase.dll
  Fault Module Version: 6.3.9600.16408
  Fault Module Timestamp:   523d3001
  Exception Code:   c00000fd
  Exception Offset: 0001a360
  OS Version:   6.3.9600.2.0.0.272.7
  Locale ID:    1033
  Additional Information 1: 81ca
  Additional Information 2: 81cae32566783b059420874b47802c3e
  Additional Information 3: b637
  Additional Information 4: b6375e6f6a866fc9d00393d4649231b8

最佳答案 你看过你的每个shell的最大内存分配吗?

get-item WSMan:\localhost\Shell\MaxMemoryPerShellMB

如果它太低了改变这个;

set-item WSMan:\localhost\Shell\MaxMemoryPerShellMB 2048
点赞