Page file manipulation using PowerShell
Nov 25, 2013 15:56 · 69 words · 1 minute read
Handy little script for changing the location of the system page file using PowerShell.
$computer = Get-WmiObject Win32_computersystem -EnableAllPrivileges
$computer.AutomaticManagedPagefile = $false
$computer.Put()
$CurrentPageFile = Get-WmiObject -Query “select * from Win32_PageFileSetting where name='c:\\pagefile.sys’”
$CurrentPageFile.delete()
Set-WMIInstance -Class Win32_PageFileSetting -Arguments @{name="d:\pagefile.sys”;InitialSize = 0; MaximumSize = 0}
I can’t take any credit for this script, I’m posting it here so that I can find easily find it again in the future J