mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-23 05:01:37 +01:00
Update check-cpu.ps1
This commit is contained in:
parent
dfad9e5084
commit
af18ccd73b
@ -2,14 +2,14 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks the CPU temperature
|
Checks the CPU temperature
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script checks the CPU temperature.
|
This PowerShell script queries the CPU temperature and returns it.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-cpu
|
PS> ./check-cpu
|
||||||
✔️ CPU has 30.3 °C
|
CPU is 30.3 °C warm.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -21,7 +21,6 @@ try {
|
|||||||
$Temp = @($data)[0].HighPrecisionTemperature
|
$Temp = @($data)[0].HighPrecisionTemperature
|
||||||
$Temp = [math]::round($Temp / 100.0, 1)
|
$Temp = [math]::round($Temp / 100.0, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Temp -gt 80) {
|
if ($Temp -gt 80) {
|
||||||
$Reply = "CPU is $($Temp)°C extremely hot!"
|
$Reply = "CPU is $($Temp)°C extremely hot!"
|
||||||
} elseif ($Temp -gt 50) {
|
} elseif ($Temp -gt 50) {
|
||||||
@ -33,8 +32,7 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$Reply = "CPU is $($Temp)°C extremely cold!"
|
$Reply = "CPU is $($Temp)°C extremely cold!"
|
||||||
}
|
}
|
||||||
|
& "$PSScriptRoot/give-reply.ps1" $Reply
|
||||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user