管理员身份运行

function Get-Temperature { 
    $t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" 
    $returntemp = @() 

    foreach ($acpi in $t) 
    {
        $temp = $acpi.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

标签: none

添加新评论