Page File – Command Line

I would like to share with you several page file command which may be useful for you to run any process to a bulk of Windows Servers or Windows Client machines. My suggestion is to copy the following commands to your “Script” repository because I pretty confident it will be useful for you whenever.

Remove Page File from the machine:


Set-executionPolicy RemoteSigned -force $pf = gwmi Win32_ComputerSystem if 
($pf.AutomaticManagedPagefile) { $pf.AutomaticManagedPagefile = $False $pf.Put() } $pg = gwmi win32_pagefilesetting if ($pg) { $pg.Delete() }


Set Page File as “System Managed Size”:

REG add “HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management” /v “PagingFiles” /t REG_MULTI_SZ /d “C:\pagefile.sys 0 0” /f


Set Page file as custom size:

wmic pagefileset where name=”C:\\pagefile.sys” set InitialSize=1048,MaximumSize=1048