Change WinRM Max Memory Per Shell in Regedit
This guide explains how to adjust the maximum memory allocated to Windows Remote Management (WinRM) shell processes using the Windows Registry Editor (Regedit). By default, WinRM enforces a memory quota per shell to prevent remote operations from exhausting system resources, which can lead to out-of-memory errors during heavy automation or script execution. Increasing this limit in the registry allows remote PowerShell and WinRS processes to utilize more system memory.
Step 1: Open the Registry Editor
- Press Windows Key + R to open the Run dialog box.
- Type
regeditand press Enter or click OK. - Select Yes if prompted by User Account Control (UAC).
Step 2: Navigate to the WinRM Registry Key
Depending on whether you are configuring the general WinRM service policy or the specific PowerShell plugin quota, navigate to the appropriate path in the left pane:
For WinRM Service Policy (Global):
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Service\WinRS(If theWinRSkey does not exist underService, right-clickService, select New > Key, and name itWinRS.)For PowerShell Endpoint Quotas:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Plugin\Microsoft.PowerShell\Quotas
Step 3: Modify or Create the MaxMemoryPerShellMB Value
- Right-click the target key (
WinRSorQuotas) in the left pane. - If the value does not exist, select New > DWORD (32-bit)
Value and name it
MaxMemoryPerShellMB. - Double-click the
MaxMemoryPerShellMBvalue. - Under Base, select the Decimal radio button.
- In the Value data field, enter the desired memory
limit in megabytes (for example, enter
1024for 1 GB,2048for 2 GB, or4096for 4 GB). - Click OK to save the changes.
Step 4: Restart the WinRM Service
For the registry changes to take effect, the WinRM service must be restarted:
Open an elevated Command Prompt or PowerShell terminal.
Run the following command:
net stop winrm && net start winrmOr in PowerShell:
Restart-Service WinRM
The new memory limit is now applied to all newly created WinRM shell sessions on the system.