Monday, November 25, 2013

Page file manipulation using PowerShell

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

No comments:

A little about Me

My photo
My name is Mitch Beaumont and I've been a technology professional since 1999. I began my career working as a desk-side support engineer for a medical devices company in a small town in the middle of England (Ashby De La Zouch). I then joined IBM Global Services where I began specialising in customer projects which were based on and around Citrix technologies. Following a couple of very enjoyable years with IBM I relocated to London to work as a system operations engineer for a large law firm where I responsible for the day to day operations and development of the firms global Citrix infrastructure. In 2006 I was offered a position in Sydney, Australia. Since then I've had the privilege of working for and with a number of companies in various technology roles including as a Solutions Architect and Technical team leader.