To be more specific, I need one script that will disable it, then after rebooting I want to run another script that will set the min and max, the code I have for that is:
Sub SetPF ()
Dim strComputer,oWMIService,colCSItems,oCSItem,colPageFiles,strRAMCount,oPageFile
strComputer = "."
Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colCSItems = oWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
Set colPageFiles = oWMIService.ExecQuery ("Select * from Win32_PageFileSetting")
' Get the amount of installed physical memory
For Each oCSItem In colCSItems
strRAMCount = oCSItem.TotalPhysicalMemory / 1048576
Next
' Set the Min and Max page file size
For Each oPageFile in colPageFiles
oPageFile.InitialSize = Round(strRAMCount)
oPageFile.MaximumSize = Round(strRAMCount * 1.5)
oPageFile.Put_
Next
End Sub
And this works, but I just ran a test using C:\WINDOWS\system32\pagefileconfig.vbs to delete the pf first and the script above does not enable it again so I need to add some code to it.



Help
Back to top











