Asked by:
Page File Stats

Question
-
Hello Forum
I've found the following page that returns some very useful Page File Stats
http://blogs.metcorpconsulting.com/tech/?p=188
And I've derived the following code based on the article: -
$PageFile = Get-WmiObject -class “Win32_PageFileSetting” -computername $server
$PageFileCount = $PageFile.CountIF ($PageFileCount -gt 1)
{ ## OPEN IF – There are multiple pagefiles
write-Host “Gathering multiple PageFile data on $server …”
$PageFileCount–
For ($PFCount = 0;$PFCount -le $PageFileCount;$PFCount++)
{ ## OPEN Bracket FOR loop to total PageFile size
$PageFileMaxSize = $PageFileMaxSize + $PageFile[$PFCount].MaximumSize
$PageFileSizeArray += @($PageFileMaxSize)
$PageFileUsed =$PageFileUsed + Get-WmiObject -computer $server -Class Win32_PageFileUsage
$PageFileUsedBySQLProcess = $PageFileUsedBySQLProcess + Get-WmiObject -computer $server -Class Win32_PageFileUsage SQL*
} ## CLOSE Bracket FOR loop to total PageFile size
$PageFileSize = $PageFileMaxSize
} ## CLOSE IF – There are multiple pagefilesELSE
{ ## OPEN IF – There is 1 pagefile
IF (!$PageFile)
{ ## OPEN IF – There is no data in the Pagefile variable
write-Host “PageFile on $server is managed by the system. Gathering data now …”
$PageFileUsed = Get-WmiObject -computer $server -Class Win32_PageFileUsage
$PageFileUsedBySQLProcess=Get-WmiObject -computer $server -Class Win32_PageFileUsage SQL*
$PageFileSize = $PageFile.PeakUsage
} ## CLOSE IF – There is no data in the Pagefile variable
ELSE
{ ## OPEN IF – There is data in the Pagefile variable
write-Host “Gathering PageFile data on $server …”
# $PageFileInitSize = $PageFile.InitialSize
$PageFileMaxSize = $PageFile.MaximumSize
$PageFileSize = $PageFileMaxSize
} ## CLOSE IF – There is data in the Pagefile variable
} ## CLOSE IF – There is 1 pagefileThe two questions I have are as follows: -
How can I return the values in 1Gb increments?
For the items in Bold; will this return pagefile usage specific to SQL Processes?
Many thanks
Please click "Mark As Answer" if my post helped. Tony C.
Wednesday, August 9, 2017 11:17 AM
All replies
-
To convert to Gb divide by Gb:
10000000000/1Gb
To get PF usage for a process:
Get-Process SQL*|select *page*
\_(ツ)_/
Wednesday, August 9, 2017 3:47 PM -
Hello jrv
The site is reporting that you replied to this but your reply is not being displayed, can you please repost your reply?
Thanks
Please click "Mark As Answer" if my post helped. Tony C.
Thursday, August 10, 2017 7:28 AM -
The site is having issues.
\_(ツ)_/
Thursday, August 10, 2017 8:10 AM -
Hi,
Just checking in to see if the information provided was helpful. Please let us know if you would like further assistance.
Best Regards,
FrankPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.Wednesday, September 6, 2017 7:44 AM