Add CPU temperature for Windows

This commit is contained in:
Markus Fleschutz 2021-05-20 11:54:35 +02:00
parent 285895f4ae
commit e168150f2a

View File

@ -10,8 +10,9 @@ try {
[int]$IntTemp = get-content "/sys/class/thermal/thermal_zone0/temp" [int]$IntTemp = get-content "/sys/class/thermal/thermal_zone0/temp"
$Temp = [math]::round($IntTemp / 1000.0, 1) $Temp = [math]::round($IntTemp / 1000.0, 1)
} else { } else {
write-warning "Sorry, no CPU temperature available" $data = Get-WMIObject -Query "SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation" -Namespace "root/CIMV2"
exit 0 $Temp = @($data)[0].HighPrecisionTemperature
$Temp = [math]::round($Temp / 1000.0, 1)
} }
if ($Temp -gt "80") { if ($Temp -gt "80") {