Jump to content

Recommended Posts

Posted

I hope someone finds this useful. I wrote a subroutine in VBscript to set the page file. It creates a page file that is twice the amount of RAM in your system.

'**********************************************************************

'** Subroutine; Page File configuration                              **

'**********************************************************************

Sub ConfigPageFile

Dim strComputer, objWMIService, objSWbemServices, colPageFile, colSWbemObjectSet

Dim objSWbemObject, SystemRAM, objPageFile

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 / 1000

Next

For Each objPageFile In colPageFile

  objPageFile.InitialSize = 2 * SystemRAM

  objPageFile.MaximumSize = 2 * SystemRAM

  objPageFile.Put_

Next

End Sub


Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...