PowerShell Script to set the size of pagefile.sys [closed]

拥有回忆 提交于 2019-12-10 13:21:33

问题


How to set the size of Page File on Windows(pagefile.sys) via PowerShell?


回答1:


This is how we can update the size of pagefile.sys via PowerShell:

# PowerShell Script to set the size of pagefile.sys

$computersys = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges;
$computersys.AutomaticManagedPagefile = $False;
$computersys.Put();
$pagefile = Get-WmiObject -Query "Select * From Win32_PageFileSetting Where Name like '%pagefile.sys'";
$pagefile.InitialSize = <New_Value_For_Size_In_MB>;
$pagefile.MaximumSize = <New_Value_For_Size_In_MB>;
$pagefile.Put();

Execute the script as below:

PS> .\update_pagefile_size.ps1;


来源:https://stackoverflow.com/questions/37813441/powershell-script-to-set-the-size-of-pagefile-sys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!