benners Posted November 22, 2005 Posted November 22, 2005 The Pagefile info is stored here [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]"PagingFiles"=your pagefile size and locationExport the reg key and import from cmdlines.txt (untested by me) or after 1st logon, which is what I do, then after next reboot it should be on the drive you want and the size you want.
Mikep7779 Posted November 22, 2005 Author Posted November 22, 2005 so[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]"PagingFiles"=4000 c:\ ?
DL. Posted November 22, 2005 Posted November 22, 2005 (edited) Exporting the key from the registry will work, partly. Set the pagefile as you want it in Windows and then export the reg-key (it cannot be set the way you think, by writing it manually).The pagefile will be set to the size you want, but it will use the absolute path set in the reg-file (for example drive/partition F:\). If you change the partitions the pagefile will not be set correctly. It can also be set using a batch to run pagefileconfig.vbs (in System32). Edited November 22, 2005 by DL.
Crash&Burn Posted November 22, 2005 Posted November 22, 2005 What I have stored in my registry at: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"PagingFiles" =hex(7):44,00,3a,00,5c,00,70,00,61,00,67,00,65,00,66,00,69,00,6c,\00,65,00,2e,00,73,00,79,00,73,00,20,00,31,00,35,00,33,00,36,00,20,00,32,00,\30,00,34,00,38,00,00,00,00,00Which is for D:\Pagefile.sys 1536 2048So using this within a .cmd or such during unattended would preset the pagefile to where you want? Instead of having windows preselect the drive with the amount of space it believes it requires?
RogueSpear Posted November 22, 2005 Posted November 22, 2005 (edited) Here is a VBscript I wrote that will set the pagefile to double the size of your system's RAM:Option Explicit'Subroutine; Page File configurationSub ConfigPageFile Dim strComputer, objWMIService, objSWbemServices, colPageFile, colSWbemObject Dim colSWbemObjectSet, objSWbemObject, objPageFile, SystemRAM strComputer = "." Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set objSWbemServices = GetObject("winmgmts:\\" & strComputer) Set colPageFile = objWMIService.ExecQuery ("SELECT * FROM Win32_PageFileSetting") Set colSWbemObjectSet = objSWbemServices.InstancesOf("Win32_LogicalMemoryConfiguration") For Each objSWbemObject In colSWbemObjectSet SystemRAM = objSWbemObject.TotalPhysicalMemory / 1024 Next For Each objPageFile In colPageFile objPageFile.InitialSize = 2 * SystemRAM objPageFile.MaximumSize = 2 * SystemRAM objPageFile.Put_ NextEnd SubConfigPageFilePlease note that since the script utilizes WMI it cannot be run from cmdlines.txt. Instead this can run from RunOnceEx or GuiRunOnce. Edited November 22, 2005 by RogueSpear
RogueSpear Posted November 22, 2005 Posted November 22, 2005 You would want to take the code I supplied above and save it to a file with a .vbs extention. Something like PageFile.vbs. Then just make that one of your RunOnceEx entries.
Mikep7779 Posted November 22, 2005 Author Posted November 22, 2005 Now, does it detect that i have 1gb of ram or does the 1024 tell it i do?
RogueSpear Posted November 22, 2005 Posted November 22, 2005 It detects how much you have. The 1024 reference is just part of an equation to convert the amount of RAM into a number I could use.
Mikep7779 Posted November 22, 2005 Author Posted November 22, 2005 ok thanks for this, this is verry usefull.
gunsmokingman Posted November 22, 2005 Posted November 22, 2005 Here are some VBS Scripts for setting the page fileSave As User_Input_PageFilestrComputer = "."Dim Pmin,PmaxSet objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colPageFiles = objWMIService.ExecQuery("Select * from Win32_PageFileSetting")Pmin = InputBox("Type In The Minimum Size For The Page File","Min Size")Pmax = InputBox("Type In The Maximum Size For The Page File","Max Size")For Each objPageFile in colPageFiles objPageFile.InitialSize = Pmin objPageFile.MaximumSize = Pmax objPageFile.Put_NextHere is a script where you fill it in then you run it.This color Text is where you add your size for the min and mac sizestrComputer = "."Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colPageFiles = objWMIService.ExecQuery("Select * from Win32_PageFileSetting")For Each objPageFile in colPageFiles objPageFile.InitialSize = 512 objPageFile.MaximumSize = 512 objPageFile.Put_Next
artbio Posted October 27, 2008 Posted October 27, 2008 This is my AutoIt script to set the pagefile.It sets pagefile to a fixed size of twice the system RAM. But it goes a few steps further.It does a more accurate check of the system RAM. And checks if free space on drive is enough. Otherwise it lets the OS manage the pagefile.Dim $iSystemRAM$objWMIService = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\localhost\root\CIMV2")$colPhysicalMemory = $objWMIService.ExecQuery("Select * From Win32_PhysicalMemory")For $objPhysicalMemory In $colPhysicalMemory $iSystemRAM += $objPhysicalMemory.CapacityNext$iPageFileSize = 2 * $iSystemRAM / (1024 ^ 2)$colPageFile = $objWMIService.ExecQuery("Select * From Win32_PageFile")For $objPageFile In $colPageFile If DriveSpaceFree($objPageFile.Drive & $objPageFile.Path) > 1.5 * ( $iPageFileSize - $objPageFile.FileSize / (1024 ^ 2) ) Then $sSettingID = $objPageFile.FileName & "." & $objPageFile.Extension & " @ " & $objPageFile.Drive $colPageFileSetting = $objWMIService.ExecQuery('Select * From Win32_PageFileSetting Where SettingID = "' & $sSettingID & '"') For $objPageFileSetting In $colPageFileSetting With $objPageFileSetting .InitialSize = $iPageFileSize .MaximumSize = $iPageFileSize .Put_ EndWith Next EndIfNextRegards.
compstuff Posted January 5, 2009 Posted January 5, 2009 Artbio... I just tried this on two different XP Pro systems with 4 Gig of RAM and they both failed with:Line-1:Error: The requested action with this object has failed.I ran it in a virtual machine and the page file setting changed to the wrong value... any ideas would be really great as this is exactly what I want to do in my integrated installation cd'sTHANKS
artbio Posted January 5, 2009 Posted January 5, 2009 Hi compstuff.You must run this script at a stage of Windows XP Setup where WMI is already installed and fully functional. Otherwise it will return that kind of error. Run it at GuiRunOnce or RunOnceEx and you will be fine.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now