Files
2025-05-19 15:19:36 -04:00

9 lines
234 B
PowerShell

$cpuUsage = Get-Counter '\Processor(_Total)\% Processor Time'
$averageCpuUsage = [math]::round($cpuUsage.CounterSamples.CookedValue, 2)
if ($averageCpuUsage -gt 80) {
Write-Output "High CPU usage"
exit 1
} else {
exit 0
}