PC Temperature Monitor
Query hardware temperature sensors on Windows and present results in both a colored HTML report and a text table.
Prerequisites
- Windows OS
- PowerShell 5.1 or later
- Administrator privileges are required to read CPU temperature sensors
LibreHardwareMonitor Setup
- Check if
LibreHardwareMonitorexists at$env:TEMP\LibreHardwareMonitor\LibreHardwareMonitorLib.dll. - If missing, download the latest release zip from
https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/releases/latest.- Look for the asset named
LibreHardwareMonitor.zip. - Download it to
$env:TEMP\LibreHardwareMonitor.zip. - Extract it to
$env:TEMP\LibreHardwareMonitor\.
- Look for the asset named
- Verify
LibreHardwareMonitorLib.dllexists after extraction.
Query Workflow
1. Elevated Temperature Query
Use scripts/query-temp.ps1 to perform the actual sensor reading. Because CPU temperature sensors require admin rights, launch it via Start-Process -Verb RunAs.
Example:
$queryScript = "$env:TEMP\lhm_query.ps1"
# Copy or reference scripts/query-temp.ps1 content
Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$queryScript`"" -ErrorAction Stop
Wait up to 20 seconds for the output file $env:TEMP\lhm_temps_result.txt to appear.
2. Read Results
Parse the result file. Each line format:
<Hardware Name> | <Sensor Name> = <Value> C | <yyyy/M/d HH:mm:ss>
3. Generate HTML Report
Use scripts/generate-html.ps1 to produce the colored HTML report and open it in the default browser.
Example:
& "<skill-dir>\scripts\generate-html.ps1" -InputFile "$env:TEMP\lhm_temps_result.txt"
The script automatically classifies temperatures and applies colors:
- Green (
temp-normal): Normal range - Orange (
temp-warm): Warm / slightly hot - Red (
temp-hot): Overheating
Classification rules:
- CPU (
Cpu):< 65 Cnormal,65-85 Cwarm,> 85 Chot - GPU Core (
GpuNvidia/GpuAmd):< 60 Cnormal,60-83 Cwarm,> 83 Chot - GPU Hot Spot:
< 70 Cnormal,70-90 Cwarm,> 90 Chot - Distance to TjMax:
> 30normal,15-30warm,< 15hot
4. Text Summary Output
After opening the HTML report, output a Markdown text summary in the chat with this exact structure:
- Main table with columns:
Hardware,Sensor,Temperature,Query Time - Summary table with columns:
Hardware,Key Metric,Temperature - Status lines prefixed with
🌡️ 温度总结:CPU: <正常/略热/过热>GPU: <正常/略热/过热>Overall: <正常/略热/过热>
Keep the summary concise. Do not add suggestions or lengthy explanations unless explicitly requested.
Notes
- If the user says
tempas a standalone command, execute the full workflow immediately. - The HTML report is saved to
$env:TEMP\temperature_report.htmland overwritten on each run. - UAC behavior depends on local Windows policy. If
ConsentPromptBehaviorAdminis0for admin users, elevation may be silent. Otherwise the user may see a UAC prompt.
