(PowerShell) Thermal Zone Temperature by Glacius

Sept. 26, 2020, midnight | 1 year, 9 months

Description:

If the return is “MSAcpi_ThermalZoneTemperature not supported, it means you are in a virtualized environment.
Reference : https://gist.github.com/teixeira0xfffff/36293713c254c69a7ba2353e8d64afce#file-msacpi_thermalzonetemperature-ps1

Code

            function Get-AntiVMwithTemperature {
    $t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
    $valorTempKelvin = $t.CurrentTemperature / 10
    $valorTempCelsius = $valorTempKelvin - 273.15
    $valorTempFahrenheit = (9/5) * $valorTempCelsius + 32
    return $valorTempCelsius.ToString() + " C : " + $valorTempFahrenheit.ToString() + " F : " + $valorTempKelvin + "K"  
}
        

Comment