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

  1. Press Windows Key + R to open the Run dialog box.
  2. Type regedit and press Enter or click OK.
  3. 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:

Step 3: Modify or Create the MaxMemoryPerShellMB Value

  1. Right-click the target key (WinRS or Quotas) in the left pane.
  2. If the value does not exist, select New > DWORD (32-bit) Value and name it MaxMemoryPerShellMB.
  3. Double-click the MaxMemoryPerShellMB value.
  4. Under Base, select the Decimal radio button.
  5. In the Value data field, enter the desired memory limit in megabytes (for example, enter 1024 for 1 GB, 2048 for 2 GB, or 4096 for 4 GB).
  6. 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:

  1. Open an elevated Command Prompt or PowerShell terminal.

  2. Run the following command:

    net stop winrm && net start winrm

    Or in PowerShell:

    Restart-Service WinRM

The new memory limit is now applied to all newly created WinRM shell sessions on the system.