iotaukm
iotaukm

Reputation: 1

CPU Temperature data not showing in Powershell via LibreHardwareMonitorLib

Im trying to get various metrics of a windows system using LibreHardwareMonitor (primarily focused on temperature), and im limited to cli. Since i can load the LibreHardwareMonitorLib.dll file (as seen here), i decided to go this route. The issue is, i cant get any temperature data.

Running the GUI works fine, so does getting temps from the LibreHardwareMonitor in wmi (after the LibreHardwareMonitor service runs). But not from the LibreHardwareMonitorLib.dll

NOTE: i cannot use wmi with cimv2 to get temperature data. And my final solution should work in cmd/powershell. Hence, ive decided to use LibreHardwareMonitor.

See below a modified version of the snippet:

cls
$dll = "LibreHardwareMonitorLib.dll"

Unblock-File -LiteralPath $dll
Add-Type -LiteralPath $dll
$monitor = [LibreHardwareMonitor.Hardware.Computer]::new()
$monitor.IsCPUEnabled = $true
$monitor.IsStorageEnabled = $true

$monitor.Open()
foreach ($sensor in $monitor.Hardware.Sensors) {
    write-host $sensor.Name
    write-host $sensor.SensorType
    write-host $sensor.Value
}
$monitor.Close()

I am using the same script, but am not getting all metrics. I can get cpu loads, but not clock speed or temperatures.

See output below:


CPU Core #1 Thread #1
Load
99.38645
CPU Core #1 Thread #2
Load
23.83488
CPU Core #2 Thread #1
Load
31.51664
CPU Core #2 Thread #2
Load
69.42992
CPU Core #3 Thread #1
Load
0
CPU Core #3 Thread #2
Load
0
CPU Core #4 Thread #1
Load
0
CPU Core #4 Thread #2
Load
0
CPU Total
Load
10.33803
CPU Core Max
Load
99.38645
CPU Core #1
Temperature

CPU Core #2
Temperature

CPU Core #3
Temperature

CPU Core #4
Temperature

CPU Package
Temperature

CPU Core #1 Distance to TjMax
Temperature

CPU Core #2 Distance to TjMax
Temperature

CPU Core #3 Distance to TjMax
Temperature

CPU Core #4 Distance to TjMax
Temperature

Core Max
Temperature

Core Average
Temperature

CPU Core #1
Clock

CPU Core #2
Clock

CPU Core #3
Clock

CPU Core #4
Clock

Upvotes: 0

Views: 465

Answers (1)

Funkster047
Funkster047

Reputation: 1

After having this exact issue, I found running in administrator fixed the issue:) The only difference is that I'm doing it all in C# code.

Upvotes: 0

Related Questions