From e168150f2a35f78814a60510ad320a421f88ee5b Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 20 May 2021 11:54:35 +0200 Subject: [PATCH] Add CPU temperature for Windows --- Scripts/check-cpu-temp.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Scripts/check-cpu-temp.ps1 b/Scripts/check-cpu-temp.ps1 index 394b35a0..ce149663 100755 --- a/Scripts/check-cpu-temp.ps1 +++ b/Scripts/check-cpu-temp.ps1 @@ -10,8 +10,9 @@ try { [int]$IntTemp = get-content "/sys/class/thermal/thermal_zone0/temp" $Temp = [math]::round($IntTemp / 1000.0, 1) } else { - write-warning "Sorry, no CPU temperature available" - exit 0 + $data = Get-WMIObject -Query "SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation" -Namespace "root/CIMV2" + $Temp = @($data)[0].HighPrecisionTemperature + $Temp = [math]::round($Temp / 1000.0, 1) } if ($Temp -gt "80") {