Member-only story
Four Methods to Configure Maximum PowerShell Memory in Windows Server
Fine-Tuning PowerShell for Enhanced Performance: Configuring MaxMemoryPerShellMB in Windows Server
4 min readOct 30, 2023
Introduction
Windows Server administrators often need to configure various parameters to optimize PowerShell session performance and resource allocation. One such critical parameter is the MaxMemoryPerShellMB
, which determines the maximum memory allocated to each PowerShell session. This article will explore multiple methods to configure the MaxMemoryPerShellMB
setting.
Method 1: Using PowerShell Command Line Interface
The most straightforward way to configure MaxMemoryPerShellMB
is through PowerShell itself. Follow these steps:
- Open a PowerShell command line interface.
- Navigate to the WSMan Shell configuration by using the
sl
(Set-Location) anddir
(Get-Item) commands:
PS C:\> sl WSMan:\localhost\Shell
PS WSMan:\localhost\Shell> dir
- Locate the
MaxMemoryPerShellMB
setting in the configuration. It should be displayed along with its current value. - To set a new value, use the
Set-Item
command: