Last week when my team was working on a Performance issue, I wanted to check the Page File setting on that Cluster Node. Usually I navigate to the System Properties to check the Paging File settings.
Since that instance was critical one, the performance issue on it had got a lot of attention. Hence all the sessions on that instance were in use and I could not Remote Desktop to the node. At that time me and my colleague were discussing if there was a script to check the Page File allocation on a server. I did not have any scripts in my repository at that time. That night I came up with the below script.
On Error Resume Next set oArgs=wscript.Arguments Set objStdOut = WScript.StdOut ServerName = trim(oArgs(0) ) Set objWMIService = GetObject("winmgmts:\\" & ServerName & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_PageFile") For Each objItem in colItems objStdOut.WriteLine " " objStdOut.WriteLine "-----------" objStdOut.WriteLine "Name: " & objItem.Name objStdOut.WriteLine "Initial Size: " & objItem.InitialSize & " MB" objStdOut.WriteLine "Current Size: " & objItem.FileSize/(1024*1024) & " MB" objStdOut.WriteLine "Maximum Size: " & objItem.MaximumSize & " MB" objStdOut.WriteLine "-----------" Next objStdOut.Close
This script accepts the Server Name as the parameter. Hence this script can be used to check the Paging File settings on the servers across the network. If this script is saved as checkpf.vbs the command to check the Paging File would be
cscript checkpf.vbs ServerName
When I executed this script on a server which had the Page files on three different drives, the output was as below.