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

2 comments:

kajal agarwal hot said...

Hi there to every one, since I am genuinely keen of
reading this website's post to be updated daily. It carries
nice data.

Unknown said...

Very good information. Its very useful for me. we need learn from real time examples and for this we choose good training institute, who were interested to know about powershell which is quite interesting. We need a good training institute for my learning .. so people making use of the free demo classes.
Many training institute provides free demo classes. One of the best training institute in Bangalore is Apponix Technologies.

https://www.apponix.com/PowerShell-Scripting/PowerShell-Scripting-Training-in-Bangalore.html

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.