ActiveXperts Network Monitor

Quicklinks

Page Files Scripts

Configuring Page File Properties
Enumerating Page File Properties
Monitoring Page File Use

Configuring Page File Properties


Sets the initial size of a page file to 300 megabytes, and the maximum size to 600 megabytes.
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 = 300
    objPageFile.MaximumSize = 600
    objPageFile.Put_
Next

Enumerating Page File Properties


Enumerates the properties of all the page files on a computer.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPageFiles = objWMIService.ExecQuery _
    ("Select * from Win32_PageFile")
For each objPageFile in colPageFiles
    Wscript.Echo "CreationDate: " & vbTab &  objPageFile.CreationDate
    Wscript.Echo "Description: " & vbTab &  objPageFile.Description
    Wscript.Echo "Drive: " & vbTab &  objPageFile.Drive        
    Wscript.Echo "FileName: " & vbTab &  objPageFile.FileName  
    Wscript.Echo "FileSize: " & vbTab &  objPageFile.FileSize  
    Wscript.Echo "InitialSize: " & vbTab &  objPageFile.InitialSize
    Wscript.Echo "InstallDate: " & vbTab &  objPageFile.InstallDate
    Wscript.Echo "MaximumSize: " & vbTab &  objPageFile.MaximumSize
    Wscript.Echo "Name: " & vbTab &  objPageFile.Name  
    Wscript.Echo "Path: " & vbTab &  objPageFile.Path  
Next

Monitoring Page File Use


Retrieves page file usage statistics.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPageFiles = objWMIService.ExecQuery _
    ("Select * from Win32_PageFileUsage")
For each objPageFile in colPageFiles
    Wscript.Echo "AllocatedBaseSize: "& vbTab &  objPageFile.AllocatedBaseSize
    Wscript.Echo "CurrentUsage: "& vbTab &  objPageFile.CurrentUsage
    Wscript.Echo "Description: "& vbTab &  objPageFile.Description
    Wscript.Echo "InstallDate: "& vbTab &  objPageFile.InstallDate
    Wscript.Echo "Name: "& vbTab &  objPageFile.Name   
    Wscript.Echo "PeakUsage: "& vbTab &  objPageFile.PeakUsage 
Next