Lazy Windows show stats
The script needs to be run in a Powershell session.
This script shows the processor usage and the memory usage(%).
Tested with PowerShell version >= 4
$script = 'while ($true) { $ps = Get-WmiObject -Class Win32_Processor $index = 0 foreach($p in $ps) { $index = $index +1 if ($p.Loadpercentage) { $deviceId = $p.deviceid Write-Progress -Id $index -Activity "Processor-$deviceId" ` -Status "Usage->" -PercentComplete $p.LoadPercentage } } $mem = Get-WmiObject -Class Win32_OperatingSystem $usageMem = 100 - ($mem.TotalVisibleMemorySize - ` $mem.FreePhysicalMemory)/$mem.TotalVisibleMemorySize*100 if ($usageMem) { Write-Progress -Id ($index+1) -Activity "Memory" -Status "Usage->" ` -PercentComplete $usageMem } start-sleep 1 }' $scriptName = "show-stats.ps1" $path = Join-Path $env:temp $scriptName echo $script > $path $processP = Start-Process -NoNewWindow ` -FilePath "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" ` -ArgumentList "-file $path" -PassThru $pPid = $processP.ID Write-Host "To stop this process, run 'Stop-Process $pPid'"
That's all, folks!
Tweet