我们如何通过 WMI 获得 CPU 温度?
How can we get a CPU temperature through WMI?
我从 here 安装了 WMI code creator,我想知道我们如何使用它来获取 CPU 温度。
该应用程序提供了很多选项(如下所示),但我不确定我必须单击哪里才能获得 CPU 温度。
我去 WMI code creator 的描述中看到了以下内容:
The WMI Code Creator tool allows you to generate VBScript, C#, and VB
.NET code that uses WMI to complete a management task such as querying
for management data, executing a method from a WMI class, or receiving
event notifications using WMI.
命名空间:root\wmi
路径:MSAcpi_ThermalZoneTemperature
从 Windows 命令行 (cmd.exe
) 到 运行 这个(使用 wmic
)命令将是:
wmic /namespace:\root\wmi PATH MSAcpi_ThermalZoneTemperature get CriticalTripPoint, CurrentTemperature
注意:结果在Kelvin * 10
,所以需要用结果除以10,再减去273.15得到摄氏度。
更多信息:
WUtils.com : MSAcpi_ThermalZoneTemperature
Properties
- 维基百科:Windows Management Instrumentation (WMI)
- MSDN:WMI Command Line (WMIC)
- 技术顾问:What's the Best CPU Temperature?
- SpeedFan:Fan & Temperature control utility(免费软件)
- 系统信息:systeminformation npm package (for nodejs)
我的 HP 笔记本电脑具有 HP 特定的 WMI 对象,其中包含以摄氏度为单位的温度和风扇 RPM 速度对象。
运行管理员模式下的这个 WMIC 命令将检索它们:
wmic /NAMESPACE:\root\HP\InstrumentedBIOS path HPBIOS_BIOSNumericSensor get Name,CurrentReading
添加每 5 秒循环一次的 for 语法:
FOR /L %G IN (1,1,100) DO wmic /NAMESPACE:\root\HP\InstrumentedBIOS path HPBIOS_BIOSNumericSensor get Name,CurrentReading && PING localhost -l 0 -n 5 >NUL
对于那些正在寻找 PowerShell 解决方案的人:
Get-CimInstance -Namespace root/wmi -ClassName MsAcpi_ThermalZoneTemperature -Filter "Active='True' and CurrentTemperature<>2732" -Property InstanceName, CurrentTemperature |
Select-Object InstanceName, @{n='CurrentTemperatureC';e={'{0:n0} C' -f (($_.CurrentTemperature - 2732) / 10.0)}}
此处的 WMI/CIM 过滤器仅查找未返回 0 C 作为温度的活动传感器。我的系统 returns 多个具有该值的传感器,我假设它们只是被禁用或以其他方式 non-functional。 InstanceName
属性 应该可以让您大致了解传感器的位置。在我的系统中,即使 属性 应该是 K 的十分之一度,它总是以整数度值报告,并且它似乎将 -273.15 C 绝对零四舍五入到 -273.2。其他系统或传感器可能有所不同。
请注意,您必须是管理员才能查询MsAcpi_ThermalZoneTemperature class。
在我的戴尔笔记本电脑上,我可以获得 CPU- 摄氏温度,如下所示:
$data = Get-WMIObject -Query "SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation" -Namespace "root/CIMV2"
@($data)[0].HighPrecisionTemperature
我从 here 安装了 WMI code creator,我想知道我们如何使用它来获取 CPU 温度。
该应用程序提供了很多选项(如下所示),但我不确定我必须单击哪里才能获得 CPU 温度。
我去 WMI code creator 的描述中看到了以下内容:
The WMI Code Creator tool allows you to generate VBScript, C#, and VB .NET code that uses WMI to complete a management task such as querying for management data, executing a method from a WMI class, or receiving event notifications using WMI.
命名空间:root\wmi
路径:MSAcpi_ThermalZoneTemperature
从 Windows 命令行 (cmd.exe
) 到 运行 这个(使用 wmic
)命令将是:
wmic /namespace:\root\wmi PATH MSAcpi_ThermalZoneTemperature get CriticalTripPoint, CurrentTemperature
注意:结果在Kelvin * 10
,所以需要用结果除以10,再减去273.15得到摄氏度。
更多信息:
WUtils.com :
MSAcpi_ThermalZoneTemperature
Properties- 维基百科:Windows Management Instrumentation (WMI)
- MSDN:WMI Command Line (WMIC)
- 技术顾问:What's the Best CPU Temperature?
- SpeedFan:Fan & Temperature control utility(免费软件)
- 系统信息:systeminformation npm package (for nodejs)
我的 HP 笔记本电脑具有 HP 特定的 WMI 对象,其中包含以摄氏度为单位的温度和风扇 RPM 速度对象。 运行管理员模式下的这个 WMIC 命令将检索它们:
wmic /NAMESPACE:\root\HP\InstrumentedBIOS path HPBIOS_BIOSNumericSensor get Name,CurrentReading
添加每 5 秒循环一次的 for 语法:
FOR /L %G IN (1,1,100) DO wmic /NAMESPACE:\root\HP\InstrumentedBIOS path HPBIOS_BIOSNumericSensor get Name,CurrentReading && PING localhost -l 0 -n 5 >NUL
对于那些正在寻找 PowerShell 解决方案的人:
Get-CimInstance -Namespace root/wmi -ClassName MsAcpi_ThermalZoneTemperature -Filter "Active='True' and CurrentTemperature<>2732" -Property InstanceName, CurrentTemperature |
Select-Object InstanceName, @{n='CurrentTemperatureC';e={'{0:n0} C' -f (($_.CurrentTemperature - 2732) / 10.0)}}
此处的 WMI/CIM 过滤器仅查找未返回 0 C 作为温度的活动传感器。我的系统 returns 多个具有该值的传感器,我假设它们只是被禁用或以其他方式 non-functional。 InstanceName
属性 应该可以让您大致了解传感器的位置。在我的系统中,即使 属性 应该是 K 的十分之一度,它总是以整数度值报告,并且它似乎将 -273.15 C 绝对零四舍五入到 -273.2。其他系统或传感器可能有所不同。
请注意,您必须是管理员才能查询MsAcpi_ThermalZoneTemperature class。
在我的戴尔笔记本电脑上,我可以获得 CPU- 摄氏温度,如下所示:
$data = Get-WMIObject -Query "SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation" -Namespace "root/CIMV2"
@($data)[0].HighPrecisionTemperature