When running scripts in a large environment, you could run into an exception in PowerShell telling you it’s out of memory.
To get the value of the amount of memory available per shell, run the following command:
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:
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 π
From the steps required to apply the newly set value I assume it’s a permanent change. And if I happen to run into the out of memory error in a remoting session I’d have to change the MaxMemoryPerShellMB on the remoting target, right?
Hi Megamorf,
Take a look at this excelent post by Ed Wilson (MSFT) https://blogs.technet.com/b/heyscriptingguy/archive/2013/07/30/learn-how-to-configure-powershell-memory.aspx
Explains it π
Jeff.
Hi Megamorf,
Take a look at this excelent post by Ed Wilson (MSFT) https://blogs.technet.com/b/heyscriptingguy/archive/2013/07/30/learn-how-to-configure-powershell-memory.aspx
Explains it π
Jeff.