On Windows operating systems, we use the Resource Monitor to check the memory paging for my server.

I need to check it via command line so I can put in my standard script to check and create text log files.

Is there a way to check the paging memory on swap for windows, but via command line?

2

2 Answers

try this:

systeminfo | find "Virtual Memory"

this will return:

Virtual Memory: Max Size: 17.297 MB Virtual Memory: Available: 7.186 MB Virtual Memory: In Use: 10.111 MB 

here is my powershell script that returns swap usage:

$maxSizeStr = systeminfo | select-string "Virtual Memory: Max Size:" $maxSize = [int][regex]::Matches($maxSizeStr, '[\d.]+').Value -replace "\.","" $inUseStr = systeminfo | select-string "Virtual Memory: In Use:" $inUse = [int][regex]::Matches($inUseStr, '[\d.]+').Value -replace "\.","" $swapUsage = ($inUse / $maxSize) * 100 Write-Output $swapUsage 
1

Is my powershell script returns swap usage

$colItems = get-wmiobject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost foreach ($objItem in $colItems) { $allocate = $objItem.AllocatedBaseSize $current = $objItem.CurrentUsage } write-host ($allocate - $current) 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy