jackailocal / windows /hwscan-windows.ps1
jackboy70's picture
Deploy: accurate lite-builder note
f25362a
Raw History Blame Contribute Delete
1.2 kB
[CmdletBinding()]
param([string]$OutputPath = "diagnostics\hardware.json")
$ErrorActionPreference = "SilentlyContinue"
$cpu = Get-CimInstance Win32_Processor | Select-Object -First 1
$memBytes = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory
$gpus = Get-CimInstance Win32_VideoController | ForEach-Object {
[pscustomobject]@{ name=$_.Name; vram_gb=[math]::Round(($_.AdapterRAM / 1GB),1); driver=$_.DriverVersion }
}
$drive = Get-Item (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
$profile = [ordered]@{
collected_at = (Get-Date).ToString("o")
os = "windows"
cpu_name = $cpu.Name
cpu_threads = $cpu.NumberOfLogicalProcessors
ram_gb = [math]::Round($memBytes / 1GB, 1)
gpus = $gpus
vram_gb = [double](($gpus | Measure-Object -Property vram_gb -Maximum).Maximum)
whichllm = $null
}
if (Get-Command whichllm -ErrorAction SilentlyContinue) {
try { $profile.whichllm = (whichllm --top 10 --json | ConvertFrom-Json) } catch { $profile.whichllm_error = $_.Exception.Message }
}
New-Item -ItemType Directory -Force -Path (Split-Path $OutputPath) | Out-Null
$profile | ConvertTo-Json -Depth 20 | Set-Content -Encoding UTF8 $OutputPath
$profile | ConvertTo-Json -Depth 20