Память

Посмотреть объем свободной памяти

Get-WmiObject Win32_OperatingSystem | fl *free*
 
 
Get-WmiObject Win32_PerfFormattedData_PerfOS_Memory | ForEach-Object {
    $_.AvailableBytes - ($_.StandbyCacheNormalPriorityBytes + $_.StandbyCacheReserveBytes)
}

Ограничение памяти для PowerShell сессии

Learn How to Configure PowerShell Memory

  ls WSMan:\localhost\Shell\MaxMemoryPerShellMB
  ls WSMan:\localhost\Shell\
  cd WSMan:\localhost\Shell
  ls
  #  MaxMemoryPerShellMB  ???
  #  Установить лимит
  Set-Item .\MaxMemoryPerShellMB 2048
  Restart-Service winrm  

Отдельно может быть ограничение для плагинов PowerShell

get-Item "WSMan:\localhost\Plugin\Microsoft.PowerShell\Quotas\MaxMemoryPerShellMB"

Параметр MaxMemoryPerShellMB хранится в в ветке реестра

  HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Service\WinRS