Adjust WinRM Max Memory Pool in Regedit
This guide explains how to increase or adjust the system-wide maximum
memory pool allocated to the Windows Remote Management (WinRM) service
using the Windows Registry Editor. By default, WinRM limits the memory
allocated to each remote shell process
(MaxMemoryPerShellMB) to prevent resource exhaustion, which
can lead to “out of memory” errors during heavy remote scripts or
administrative tasks. Modifying the relevant registry keys allows
administrators to set custom memory thresholds across the operating
system.
Prerequisites and Warnings
Editing the Windows Registry incorrectly can cause system instability. Always create a backup of your registry or target keys before making changes. Administrator privileges are required to perform these modifications.
Step-by-Step Guide to Adjust WinRM Memory in Regedit
- Open Registry Editor
- Press
Win + Rto open the Run dialog box. - Type
regeditand pressEnteror click OK. - If prompted by User Account Control (UAC), click Yes.
- Press
- Navigate to the WinRM Service Key
In the Registry Editor address bar, navigate to the following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Service\WinRSNote: If the
WinRM,Service, orWinRSkeys do not exist, right-click the parent key, select New > Key, and name them accordingly to create the full path.
- Modify or Create the Memory Allocation Value
- In the right-hand pane of the
WinRSkey, look for a DWORD value namedMaxMemoryPerShellMB. - If it does not exist:
- Right-click an empty area in the right pane.
- Select New > DWORD (32-bit) Value.
- Name the value
MaxMemoryPerShellMB.
- In the right-hand pane of the
- Set the Maximum Memory Value
- Double-click
MaxMemoryPerShellMBto edit it. - Under Base, select Decimal.
- In the Value data field, enter the desired memory
limit in megabytes (MB). Common values include:
1024(1 GB)2048(2 GB)4096(4 GB)
- Click OK to save the changes.
- Double-click
Apply the Changes
For the new memory limits to take effect, the WinRM service must be restarted:
- Open an elevated Command Prompt or PowerShell window as Administrator.
- Run the following command to restart the service:
PowerShell:
Restart-Service WinRMCommand Prompt:
net stop winrm && net start winrm
Once the service restarts, remote sessions connecting to the machine will operate under the updated maximum memory threshold.