Updated check-cpu.ps1

This commit is contained in:
Markus Fleschutz 2024-06-08 10:21:01 +02:00
parent 3994d23478
commit 7bc8edc9d3

View File

@ -57,24 +57,24 @@ try {
$arch = "$arch, " $arch = "$arch, "
$deviceID = "$($details.DeviceID), " $deviceID = "$($details.DeviceID), "
$speed = "$($details.MaxClockSpeed)MHz, " $speed = "$($details.MaxClockSpeed)MHz, "
$socket = "$($details.SocketDesignation) socket, " $socket = "$($details.SocketDesignation) socket"
} }
$cores = [System.Environment]::ProcessorCount $cores = [System.Environment]::ProcessorCount
$celsius = GetCPUTemperature $celsius = GetCPUTemperature
if ($celsius -eq 99999.9) { if ($celsius -eq 99999.9) {
$temp = "no temp" $temp = "no temp"
} elseif ($celsius -gt 50) { } elseif ($celsius -gt 50) {
$temp = "$($celsius)°C" $temp = "$($celsius)°C HOT"
$status = "⚠️" $status = "⚠️"
} elseif ($celsius -lt 0) { } elseif ($celsius -lt 0) {
$temp = "$($celsius)°C" $temp = "$($celsius)°C COLD"
$status = "⚠️" $status = "⚠️"
} else { } else {
$temp = "$($celsius)°C" $temp = "$($celsius)°C OK"
} }
Write-Host "$status $cpuName ($($arch)$cores cores, $($deviceID)$($speed)$($socket)$temp)"
Write-Progress -completed "Done." Write-Progress -completed "Done."
Write-Host "$status $cpuName ($($arch)$cores cores, $($deviceID)$($speed)$($socket)) - $temp"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"