Windows PowerShell / Thermal Zone Temperature

Author Glacius
Platform Windows
Language PowerShell
Technique Thermal Zone Temperature

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"  
}

Created

September 26, 2020

Last Revised

April 22, 2024