The hardware report went out from winpe-status-push.ps1 on the enrollment share (Y:), but startnet.cmd never maps Y: on the gea-standard / gea-engineer path (choices 1/2 go purpose -> tenant -> enroll_staged), so those builds never reported. The same gap means neither the status push nor preflight.ps1's driver check has ever run for standard/engineer images. The BIOS share is mapped by every WinPE boot before the menu, and check-bios.cmd lives on it, so it now calls hardware-report.ps1 from the same folder (best effort, output discarded). winpe-status-push.ps1 goes back to status only, so shopfloor bays are not counted twice. The playbook deploys hardware-report.ps1 with the other BIOS files.
60 lines
2.2 KiB
PowerShell
60 lines
2.2 KiB
PowerShell
# hardware-report.ps1 - Report this machine's hardware to the PXE webapp so
|
|
# its Hardware Coverage page can flag models with no driver pack or BIOS.
|
|
#
|
|
# Called by check-bios.cmd, which every WinPE boot runs from the BIOS share
|
|
# before the imaging menu. That is deliberate: the enrollment share (Y:,
|
|
# where winpe-status-push.ps1 lives) is never mapped on the gea-standard /
|
|
# gea-engineer path, so anything hung off Y: misses those builds.
|
|
#
|
|
# Sends the exact WMI model PESetup matches driver packs on, the Dell
|
|
# system SKU (what Dell's catalogs key on) and the BIOS version. Runs in
|
|
# WinPE's stripped PowerShell: wmic only, no CIM cmdlets. Best effort:
|
|
# logs to X:\Windows\Temp\hardware-report.log and never fails the boot.
|
|
|
|
param(
|
|
[string]$PxeServer = $(if ($env:PXESERVER) { $env:PXESERVER } else { '172.16.9.1' }),
|
|
[int]$Port = 9009,
|
|
[int]$TimeoutSec = 5
|
|
)
|
|
|
|
$logFile = 'X:\Windows\Temp\hardware-report.log'
|
|
function Log {
|
|
param([string]$msg)
|
|
try { "$(Get-Date -Format s) $msg" | Out-File -FilePath $logFile -Append -Encoding utf8 } catch { }
|
|
}
|
|
|
|
function Get-WmicValue {
|
|
param([string]$Class, [string]$Property)
|
|
try {
|
|
$line = (& wmic $Class get $Property /value 2>$null |
|
|
Where-Object { $_ -match '=' } | Select-Object -First 1)
|
|
if ($line) { return ($line -split '=', 2)[1].Trim() }
|
|
} catch { Log "wmic $Class $Property exception: $_" }
|
|
return ''
|
|
}
|
|
|
|
$hw = @{
|
|
serial = Get-WmicValue 'bios' 'SerialNumber'
|
|
model = Get-WmicValue 'computersystem' 'Model'
|
|
manufacturer = Get-WmicValue 'computersystem' 'Manufacturer'
|
|
sku = Get-WmicValue 'computersystem' 'SystemSKUNumber'
|
|
bios_version = Get-WmicValue 'bios' 'SMBIOSBIOSVersion'
|
|
}
|
|
Log "model=$($hw.model) sku=$($hw.sku) bios=$($hw.bios_version) serial=$($hw.serial)"
|
|
|
|
if (-not $hw.model) {
|
|
Log "no model - nothing to report"
|
|
exit 0
|
|
}
|
|
|
|
try {
|
|
$resp = Invoke-WebRequest -Uri "http://${PxeServer}:${Port}/hardware/seen" -Method POST `
|
|
-Body ($hw | ConvertTo-Json -Compress) -ContentType 'application/json' `
|
|
-UseBasicParsing -TimeoutSec $TimeoutSec -ErrorAction Stop
|
|
Log "OK http=$($resp.StatusCode)"
|
|
} catch {
|
|
Log "ERR $($_.Exception.Message)"
|
|
}
|
|
|
|
exit 0
|