如何在PowerShell 5.1版本中获取CPU温度?

问题描述 投票:0回答:1

我试图使用Windows Powershell 5.1版通过运行下面的代码来获取CPU温度,但不幸的是我的Powershell没有返回任何东西。我想知道,在Windows Powershell 5.1版本中,我应该添加什么代码才能获得CPU温度?

在Windows Powershell 5.1版本中,我正在使用的代码来获取CPU温度。

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
powershell cpu temperature
1个回答
1
投票

你可以使用Open Hardware Monitor命令行工具。OpenHardwareMonitorReport.zip。

更多信息在这里。https:/superuser.coma1547638589805

© www.soinside.com 2019 - 2024. All rights reserved.