Is there a way to get the RAM Utilization with powershell/Python, without the cached ram? We want to monitor the utilization of our System parameters. At the moment I use this in powershell, which gets calles by task scheduler every 30 minutes together with other parameter checks:
...
$counts = 6
$Samples = 145
for($j=0; $j -lt $counts; $j++){
$temp = 0
$result = 0
for ($i=0; $i -lt $Samples; $i++){
$os = Get-WMIObject Win32_OperatingSystem
$os | select *memory*
$pctUsed = [math]::Round(100-($os.FreePhysicalMemory/$os.TotalVisibleMemorySize)*100,2)
$temp = $pctUsed + $temp
Start-Sleep -s 2
}
$result = $temp/$Samples
...
which will then be sent to a Monitoring application of us.
How can we get RAM without Cache? Is there a way?