Exit code tutorial
# set your test exit code (0,1,2) $exitCode = 0 switch ($exitCode) { 0 { Write-Host “[OK] Exit Code 0 delivers a green icon ” exit 0 } 1 { Write-Host “[WARNING] Exit Code 1 delivers a yellow icon” exit … Continue reading
# set your test exit code (0,1,2) $exitCode = 0 switch ($exitCode) { 0 { Write-Host “[OK] Exit Code 0 delivers a green icon ” exit 0 } 1 { Write-Host “[WARNING] Exit Code 1 delivers a yellow icon” exit … Continue reading →
Get CPU usage and inform the admin if it is at normal, high or critical level. $WARNLEVEL = 25 $CRITLEVEL = 80 $cpuusage = (Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average | Select Average) if ( ($cpuusage.average) -lt $WARNLEVEL ) … Continue reading →
Example script to get RAM usage and inform the admin if it is at normal, high or critical level. $WARNLEVEL = 65 $CRITLEVEL = 80 $ramusage = gwmi -Class win32_operatingsystem | Select-Object @{Name = “MemoryUsage”; Expression = {“{0:N2}” -f ((($_.TotalVisibleMemorySize … Continue reading →