Managing the System Managed Page File
Published Mar 15 2019 08:39 PM 832 Views
Microsoft
First published on TECHNET on Apr 14, 2009

Hello again AskPerf!  Today’s post comes to us courtesy of Mike Morales, one of our Escalation Engineers here in Irving, TX.  For those of you who have been with AskPerf for a while, Mike wrote a post for us a few months ago on UMDH.EXE .  We’ve discussed the page file in a number of different posts, but we haven’t gone into great depth regarding how the “System Managed” setting works.  We’re briefly going to cover the behavior and the differences between two versions of the OS, and then show you how you can manage the page file setting via a fairly simple WMI script.

To begin with, how does the system determine the size of the page file?  The short answer is that it depends on what operating system we are looking at.  On Windows XP and Windows Server 2003 the algorithm defines the page file using the following parameters when the System Managed setting is selected:  Initial Size: 1.5 x RAM, Maximum Size: 3 x RAM.  On Windows Vista, the algorithm changes slightly and is more dynamic.  If you have 1GB of RAM installed, the maximum page file size is RAM + 300MB.  If you had 4GB of RAM installed however, the maximum page file size is 3 x RAM.  Based on the resources that the system has (RAM / Disk Space), the system can adjust the page file size following a reboot if more memory is added or additional disk space becomes available.

Now that you know how the algorithm has changed, here’s a quick script that you can use to set the page file settings to System Managed.  On my test system, no reboot was required for the setting to take effect.  However, in order for the page file size itself to change to reflect the change in the setting, I did have to reboot my system.

**** SCRIPT DISCLAIMER****

The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business
profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPageFiles = objWMIService.ExecQuery _
("SELECT * FROM Win32_PageFileSetting")
For Each objPageFile in colPageFiles
objPageFile.InitialSize = 0
objPageFile.MaximumSize = 0
objPageFile.Put_
Next




That’s all for this post.  Thanks for stopping by – as always we value your feedback.



- Mike Morales























Share this post :







Mike also writes a column for Windows IT Pro magazine titled “What Would Microsoft Do?”

Version history
Last update:
‎Mar 15 2019 08:39 PM
Updated by: