Monday, September 9, 2013

PowerShell remoting and memory issues

I ran into an issue recently with running out of memory in a PowerShell remote session. Apparently the default for a remote session is only 150MB. Here's how to increase it (Credit) via PowerShell:

Either/Or:

Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1024

winrm set winrm/config @{MaxMemoryPerShellMB="1024"}

I also found that if you increase the memory by too much, you receive a cryptic and totally unhelpful error message when attempting to open a remote shell: 

The WSMan provider host process did not return a proper response.  A provider in the host process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic.

At that point, I had increased the shell memory size to 4096MB. Decreasing it back down to 2048MB fixed the issue.

No comments:

Post a Comment