# List Windows devices that may relate to fan / thermal / EC control.
# Run in PowerShell (Admin optional but may show more). Output saved to same folder.

$outFile = Join-Path $PSScriptRoot "设备列表_风扇温控相关_$(Get-Date -Format 'yyyyMMdd_HHmmss').txt"
$keywords = @(
    'Fan', 'Thermal', 'Temperature', 'EC ', 'Embedded Controller',
    'Intel Dynamic Tuning', 'ACPI', 'Nuvoton', 'NPCx', 'Chrome',
    'Cooling', 'Sensor', 'Power', 'Thermal Zone'
)

$all = Get-PnpDevice -ErrorAction SilentlyContinue | Where-Object { $_.Status -eq 'OK' }
$names = $all | Select-Object -ExpandProperty FriendlyName -Unique | Sort-Object
$filtered = $names | Where-Object {
    $n = $_
    $keywords | Where-Object { $n -match $_ }
}
$filtered = $filtered | Sort-Object -Unique

$lines = @()
$lines += "=== Fan / Thermal / EC related devices (keyword match) ==="
$lines += ""
if ($filtered) {
    $filtered | ForEach-Object { $lines += $_ }
} else {
    $lines += "(none matched keywords)"
}
$lines += ""
$lines += "=== Full device list (first 200, for reference) ==="
$lines += ""
$names | Select-Object -First 200 | ForEach-Object { $lines += $_ }

$text = $lines -join "`r`n"
$text | Set-Content -Path $outFile -Encoding UTF8
Write-Host "Saved: $outFile"
Write-Host ""
Write-Host "--- Fan/Thermal/EC related ---"
$filtered | ForEach-Object { Write-Host $_ }
