Created
September 4, 2015 10:53
-
-
Save bklockwood/13f6b17eb98e8f4b0a95 to your computer and use it in GitHub Desktop.
Get-Temperature
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
teukkam's comment at https://gist.github.com/jeffa00/9577816