Created
June 1, 2022 12:58
-
-
Save Trimad/56bf37dc6769cdd3fc12ae7be62f3049 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Temperature { | |
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | |
$returntemp = @() | |
foreach ($temp in $t.CurrentTemperature) | |
{ | |
$currentTempKelvin = $temp / 10 | |
$currentTempCelsius = $currentTempKelvin - 273.15 | |
$currentTempFahrenheit = (9/5) * $currentTempCelsius + 32 | |
$returntemp += $currentTempCelsius.ToString() + " C : " + $currentTempFahrenheit.ToString() + " F : " + $currentTempKelvin + " K" | |
} | |
return $returntemp | |
} | |
Get-Temperature |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment