04 Mar 2014 @ 9:16 AM 

When running scripts in a large environment, you could run into an exception in PowerShell telling you it’s out of memory.

PS-OutOfMemory

To get the value of the amount of memory available per shell, run the following command:

PS-GetMaxMemoryPerShellMB

The PowerShell MaxMemoryPerShellMB quota defaults to only 150MB in v1 and v2, and 1024MB in v3.
But even under PowerShell 3.0 large objects can consume large amounts of memory.

You can resolve the ‘out of memory’ exception simply by increasing the value of MaxMemoryPerShellMB.
To accomplish this, use the following command:

PS-SetMaxMemoryPerShellMB

As shown in the screenshot above, you can run the Get-Item command again to verify the command.

Last: Restart the winrm service… and you’re done :-)

Posted By: Jeff Wouters
Last Edit: 04 Mar 2014 @ 09:16 AM

EmailPermalink
Tags



 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 346
  • Comments » 503
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.

Speaking



    No Child Pages.

Health Check



    No Child Pages.