diff --git a/hw_report.ps1 b/hw_report.ps1 index 688b2cb5..7d52ff06 100644 --- a/hw_report.ps1 +++ b/hw_report.ps1 @@ -1,4 +1,6 @@ -[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +# SPDX-License-Identifier: Unlicense + +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $programPath = ".\nwinfo.exe" $programArgs = @("--format=json", @@ -8,7 +10,7 @@ $programArgs = @("--format=json", "--cpu", "--smbios", "--net=phys", - "--disk=no-smart", + "--disk=no-smart,phys", "--audio" ) @@ -16,6 +18,17 @@ $processOutput = & $programPath $programArgs $parsedJson = $processOutput | ConvertFrom-Json +$dmiTable = @{} +foreach ($smbiosTable in $parsedJson.'SMBIOS') { + $tableType = $smbiosTable.'Table Type' + if ($tableType -ne $null) { + if (-not $dmiTable.ContainsKey($tableType)) { + $dmiTable[$tableType] = @() + } + $dmiTable[$tableType] += $smbiosTable + } +} + Write-Output "OS:" $systemTable = $parsedJson.'System' Write-Output "`t$($systemTable.'Os')" @@ -28,10 +41,32 @@ Write-Output "`t$($cpuTable.'Brand')" Write-Output "`t`t$($cpuTable.'Code Name')" Write-Output "`t`t$($cpuTable.'Cores') cores $($cpuTable.'Logical CPUs') threads" Write-Output "`t`t$($cpuTable.'Temperature (C)') °C" +if ($null -ne $dmiTable[4]) { + Write-Output "`t`t$($dmiTable[4][0].'Socket Designation') socket" +} + +Write-Output "RAM:" +$maxCapacity = "unknown" +$numSlots = "unknown" +if ($null -ne $dmiTable[16]) { + $maxCapacity = $dmiTable[16][0].'Max Capacity' + $numSlots = $dmiTable[16][0].'Number of Slots' +} elseif ($null -ne $dmiTable[5]) { + $maxCapacity = "$($dmiTable[5][0].'Max Memory Module Size (MB)') MB" + $numSlots = $dmiTable[5][0].'Number of Slots' +} +Write-Output "`tMax Capacity $maxCapacity $numSlots slots" +if ($null -ne $dmiTable[17]) { + foreach ($mdTable in $dmiTable[17]) { + Write-Output "`t$($mdTable.'Device Type')-$($mdTable.'Speed (MT/s)') $($mdTable.'Device Size') $($mdTable.'Manufacturer')" + Write-Output "`t`t$($mdTable.'Device Locator') $($mdTable.'Bank Locator') $($mdTable.'Form Factor')" + Write-Output "`t`t$($mdTable.'Serial Number') $($mdTable.'Part Number')" + } +} Write-Output "Network:" -foreach ($net in $parsedJson.'Network') { - Write-Output "`t$($net.'Description')" +foreach ($netTable in $parsedJson.'Network') { + Write-Output "`t$($netTable.'Description')" } Write-Output "Disk:" @@ -45,6 +80,7 @@ foreach ($diskTable in $parsedJson.'Disks') { $diskType = "SSD" } Write-Output "`t`t$($diskTable.'Size') $diskType $($diskTable.'Type')" + Write-Output "`t`t$($diskTable.'Serial Number')" } Write-Output "Audio:"