Created
June 6, 2020 07:47
-
-
Save efeozyer/5ab81ae72e8a293aa2e46f8cbd91e909 to your computer and use it in GitHub Desktop.
Powershell System Resources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$totalRam = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).Sum | |
while($true) { | |
$date = Get-Date -Format "yyyy-MM-dd HH:mm:ss" | |
$cpuTime = (Get-Counter '\Processor(_Total)\% Processor Time').CounterSamples.CookedValue | |
$availMem = (Get-Counter '\Memory\Available MBytes').CounterSamples.CookedValue | |
$date + ' > CPU: ' + $cpuTime.ToString("#,0.000") + '%, Avail. Mem.: ' + $availMem.ToString("N0") + 'MB (' + (104857600 * $availMem / $totalRam).ToString("#,0.0") + '%)' | |
Start-Sleep -s 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment