mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-26 14:26:10 +01:00
Update check-cpu.ps1
This commit is contained in:
parent
3e80e5cb68
commit
e1150b70e0
@ -31,29 +31,32 @@ function GetCPUTemperatureInCelsius {
|
||||
|
||||
try {
|
||||
Write-Progress "Querying CPU details ..."
|
||||
$Status = "✅"
|
||||
$Celsius = GetCPUTemperatureInCelsius
|
||||
if ($Celsius -eq 99999.9) {
|
||||
$Temp = "no temp"
|
||||
} elseif ($Celsius -gt 50) {
|
||||
$Temp = "⚠️$($Celsius)°C"
|
||||
$Temp = "$($Celsius)°C"
|
||||
$Status = "⚠"
|
||||
} elseif ($Celsius -lt 0) {
|
||||
$Temp = "⚠️$($Celsius)°C"
|
||||
$Temp = "$($Celsius)°C"
|
||||
$Status = "⚠"
|
||||
} else {
|
||||
$Temp = "$($Celsius)°C"
|
||||
}
|
||||
|
||||
if ($IsLinux) {
|
||||
"✅ CPU has $Temp"
|
||||
"$Status CPU has $Temp"
|
||||
} else {
|
||||
$Details = Get-WmiObject -Class Win32_Processor
|
||||
$CPUName = $Details.Name.trim()
|
||||
$DeviceID = $Details.DeviceID
|
||||
$Speed = "$($Details.MaxClockSpeed)MHz"
|
||||
$Socket = $Details.SocketDesignation
|
||||
"✅ CPU $CPUName ($DeviceID, $Speed, socket $Socket, $Temp)"
|
||||
"Status CPU $CPUName ($DeviceID, $Speed, socket $Socket, $Temp)"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user