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

  1. Open Registry Editor
    • Press Win + R to open the Run dialog box.
    • Type regedit and press Enter or click OK.
    • If prompted by User Account Control (UAC), click Yes.
  2. 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\WinRS
    • Note: If the WinRM, Service, or WinRS keys do not exist, right-click the parent key, select New > Key, and name them accordingly to create the full path.

  3. Modify or Create the Memory Allocation Value
    • In the right-hand pane of the WinRS key, look for a DWORD value named MaxMemoryPerShellMB.
    • If it does not exist:
      • Right-click an empty area in the right pane.
      • Select New > DWORD (32-bit) Value.
      • Name the value MaxMemoryPerShellMB.
  4. Set the Maximum Memory Value
    • Double-click MaxMemoryPerShellMB to 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.

Apply the Changes

For the new memory limits to take effect, the WinRM service must be restarted:

  1. Open an elevated Command Prompt or PowerShell window as Administrator.
  2. Run the following command to restart the service:
    • PowerShell:

      Restart-Service WinRM
    • Command 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.