select-waxtrace-asset.ps1: read bay-config.csv (17 bays) by default

Picker was still pointed at calibrations/INDEX.csv, which only listed
14 bays that have a per-asset cal ISO ripped. Three bays we just
refreshed into bay-config.csv (WJF00450, WJF00461, WJRP0423) had no
cal-disc entry, so they fell off the menu and tech had to drop to the
free-text prompt to type the asset by hand - felt like a regression.

Two changes:
- select-waxtrace-asset.ps1: prefer bay-config.csv when -IndexPath
  points there (now the default). Auto-detect schema by checking for
  the ftpak_version column. Display columns become
  ASSET / FTPAK / MODEL / USER ID so the tech can confirm bay metadata
  at a glance before pressing Enter. Falls back to
  calibrations/INDEX.csv if bay-config.csv missing.
- startnet.cmd: invoke the picker with -IndexPath bay-config.csv.

Pushed: both boot.wim copies refreshed via wimupdate, new
select-waxtrace-asset.ps1 deployed to PXE share, new boot.wim landed
at /var/www/html/win11/sources/boot.wim on 172.16.9.1.

bay-config.csv parent-dir copy synced with scripts/bay-config.csv so
resolve-bay-config.ps1 (called from startnet.cmd in WinPE) and the
picker both see the same 17-bay set.
This commit is contained in:
cproudlock
2026-05-24 13:12:03 -04:00
parent d0dcce5427
commit 77c917157d
3 changed files with 78 additions and 36 deletions

View File

@@ -1,9 +1,10 @@
# select-waxtrace-asset.ps1 - Arrow-key bay picker for wax/trace imaging.
#
# Reads the calibration INDEX.csv on the PXE share to build the menu of known
# bays. Operator picks with Up/Down arrows + Enter. Always appends an
# "Other (new bay)" option at the end for bays that don't have a cal ISO yet -
# selecting it falls back to a free-text prompt.
# Reads bay-config.csv on the PXE share to build the menu of known bays.
# Falls back to INDEX.csv (cal-disc index) if bay-config.csv is missing.
# Operator picks with Up/Down arrows + Enter. Always appends an
# "Other (new bay)" option at the end for unlisted bays - selecting it
# falls back to a free-text prompt.
#
# Writes the chosen asset tag to $OutFile (one line, no trailing newline).
# startnet.cmd reads that file back into the MACHINENUM batch var.
@@ -14,10 +15,10 @@
# Exit codes:
# 0 = asset tag written to $OutFile
# 1 = user cancelled (Esc) - $OutFile not written
# 2 = INDEX.csv unreadable AND no fallback entered
# 2 = no readable bay source AND no fallback entered
param(
[string]$IndexPath = 'Y:\installers-post\waxtrace\calibrations\INDEX.csv',
[string]$IndexPath = 'Y:\installers-post\waxtrace\bay-config.csv',
[Parameter(Mandatory=$true)][string]$OutFile
)
@@ -27,31 +28,60 @@ function Read-BayList {
param([string]$Path)
if (-not (Test-Path -LiteralPath $Path)) { return @() }
try {
return Import-Csv -LiteralPath $Path |
Select-Object -Property asset_tag, unit_serial, probe_part |
Sort-Object -Property asset_tag -Descending
$rows = @(Import-Csv -LiteralPath $Path)
# bay-config.csv has asset_tag,ftpak_version,model,user_id,hw_sn,hw_id,host,notes
# INDEX.csv (legacy) has asset_tag,unit_serial,probe_part,...
$isBayCfg = $rows.Count -gt 0 -and ($rows[0].PSObject.Properties.Name -contains 'ftpak_version')
return $rows | Sort-Object -Property asset_tag | ForEach-Object {
if ($isBayCfg) {
[PSCustomObject]@{
asset_tag = $_.asset_tag
col1 = $_.ftpak_version
col2 = $_.model
col3 = $_.user_id
schema = 'bay-config'
}
} else {
[PSCustomObject]@{
asset_tag = $_.asset_tag
col1 = $_.unit_serial
col2 = $_.probe_part
col3 = ''
schema = 'index'
}
}
}
} catch {
return @()
}
}
function Show-Menu {
param(
[object[]]$Items,
[int]$Selected,
[string]$Title
)
param([object[]]$Items, [int]$Selected, [string]$Title, [string]$Schema)
Clear-Host
Write-Host ""
Write-Host " ========================================"
Write-Host " ============================================================"
Write-Host " $Title"
Write-Host " ========================================"
Write-Host " ============================================================"
Write-Host ""
Write-Host " Up / Down arrows = navigate, Enter = select, Esc = cancel"
Write-Host ""
if ($Schema -eq 'bay-config') {
Write-Host (" {0,-10} {1,-8} {2,-10} {3}" -f 'ASSET','FTPAK','MODEL','USER ID')
Write-Host (" {0,-10} {1,-8} {2,-10} {3}" -f '-----','-----','-----','-------')
} else {
Write-Host (" {0,-10} {1,-14} {2}" -f 'ASSET','SERIAL','PROBE')
Write-Host (" {0,-10} {1,-14} {2}" -f '-----','------','-----')
}
for ($i = 0; $i -lt $Items.Count; $i++) {
$item = $Items[$i]
$line = if ($item -is [string]) { $item } else { "{0,-10} serial={1,-12} probe={2}" -f $item.asset_tag, $item.unit_serial, $item.probe_part }
if ($item -is [string]) {
$line = $item
} elseif ($Schema -eq 'bay-config') {
$line = "{0,-10} {1,-8} {2,-10} {3}" -f $item.asset_tag, $item.col1, $item.col2, $item.col3
} else {
$line = "{0,-10} {1,-14} {2}" -f $item.asset_tag, $item.col1, $item.col2
}
if ($i -eq $Selected) {
Write-Host (" > " + $line) -ForegroundColor Black -BackgroundColor White
} else {
@@ -61,21 +91,31 @@ function Show-Menu {
Write-Host ""
}
# Try bay-config.csv first; fall back to INDEX.csv if missing OR if the
# explicit -IndexPath argument points to INDEX.csv (legacy callers).
$bays = @(Read-BayList -Path $IndexPath)
if ($bays.Count -eq 0 -and $IndexPath -notmatch 'INDEX\.csv$') {
$fallback = 'Y:\installers-post\waxtrace\calibrations\INDEX.csv'
if (Test-Path -LiteralPath $fallback) {
Write-Host " (no bay-config.csv at $IndexPath - falling back to $fallback)"
$bays = @(Read-BayList -Path $fallback)
}
}
$schema = if ($bays.Count -gt 0) { $bays[0].schema } else { 'bay-config' }
$menuItems = @()
foreach ($b in $bays) { $menuItems += $b }
$menuItems += '** Other (new bay - enter asset tag manually) **'
$sel = 0
while ($true) {
Show-Menu -Items $menuItems -Selected $sel -Title "Wax/Trace Asset Tag"
Show-Menu -Items $menuItems -Selected $sel -Title 'Wax/Trace Asset Tag' -Schema $schema
$key = [System.Console]::ReadKey($true)
switch ($key.Key) {
'UpArrow' { if ($sel -gt 0) { $sel-- } }
'DownArrow' { if ($sel -lt ($menuItems.Count - 1)) { $sel++ } }
'Enter' {
if ($sel -eq ($menuItems.Count - 1)) {
# Manual entry
Write-Host ""
$manual = Read-Host " Enter asset tag (e.g. WJRP9999) or blank to abort"
if ($manual) {

View File

@@ -1,16 +1,18 @@
asset_tag,ftpak_version,model,user_id
WJF00159,6.103,AVANT,3974839712
WJRP3689,5.510,CV-4500,3744284509
WJRP2660,6.0,CV-4500,2365986521
WJRP2659,6.0,CV-4500,2709054503
WJF00545,6.213,AVANT,3878777362
WJRP3638,5.602,CV-4500,0720778210
WJF00052,6.103,AVANT,3270314998
WJF00084,6.103,AVANT,1476212857
WJF00083,6.103,AVANT,2934506987
WJRP3025,6.0,CV-3200,2292822471
WJF00197,6.104,AVANT,1191612605
WJRP4802,6.002,AVANT,0920866935
WJRP2347,6.0,CV-4500,3585172946
WJRP2035,6.0,CV-4500,2292822471
WJRP2335,6.0,CV-4500,1780916688
asset_tag,ftpak_version,model,user_id,hw_sn,hw_id,host,notes
WJF00052,6.103,CV-4500,3270314998,100032204,00039188,G2ZTNCX3ESF,bay-config was AVANT - corrected to CV-4500 per device-map
WJF00083,6.103,AVANT,2934506987,100062206,00039341,GDMT28Y3ESF,
WJF00084,6.103,AVANT,1476212857,100042205,00039348,G2GY4SY3ESF,
WJF00159,6.103,AVANT,3974839712,100072210,00040145,G5PRTW04ESF,
WJF00197,6.104,AVANT,1191612605,300022404,00041459,GHNWYRT3ESF,
WJF00450,6.204,AVANT,MISSING_DATA,400052411,MISSING_DATA,G8KRCPZ3ESF,DO NOT MIGRATE - user_id + hw_id need dongle read
WJF00461,6.213,AVANT,3878777362,400012504,00044757,G2PMG3D4ESF,new bay (was misattributed to WJF00545 in old CSV)
WJF00545,6.213,AVANT,3268459559,500022512,00045652,G6MJG3D4ESF,user_id refreshed 2026-05-24 (was 3878777362)
WJRP0423,6.0,CV-3100,3669340917,720104,00025834,GGDBWRT3ESF,old bay - device-map name 'NewCVSV' is Mitutoyo internal for CV-3100
WJRP2035,6.0,CV-4500,2292822471,200011406,0008232,G6W7JK44ESF,live binary is 5.7.0.82 - migrating to original 6.0 target
WJRP2335,6.0,CV-4500,1780916688,800011510,00011911,G4B48FZ3ESF,live binary is 5.7.0.82 - migrating to original 6.0 target
WJRP2347,6.0,CV-4500,3585172946,800021510,00011674,GDR6B8B3ESF,live binary is 5.7.0.82 - migrating to original 6.0 target
WJRP2659,6.0,CV-4500,2709054503,000021608,00015700,G33N20R3ESF,live binary is 5.7.0.82 - migrating to original 6.0 target
WJRP2660,6.0,CV-4500,236598621,000011607,00015588,GGGMF1V3ESF,live binary is 5.7.0.92 - migrating to original 6.0 target
WJRP3638,5.602,CV-4500,0720778210,400031808,00024395,GFDBWRT3ESF,
WJRP3689,5.510,CV-4500,3744284509,400021807f,00024390,G4HCKF33ESF,live binary is 5.6.0.40 (release 5.602) - migrating to original 5.510 target
WJRP4802,6.002,AVANT,0920866935,100062108,00034683,G5W7R704ESF,live binary is 5.7.0.92 - migrating to original 6.002 target
1 asset_tag ftpak_version model user_id hw_sn hw_id host notes
2 WJF00159 WJF00052 6.103 AVANT CV-4500 3974839712 3270314998 100032204 00039188 G2ZTNCX3ESF bay-config was AVANT - corrected to CV-4500 per device-map
3 WJRP3689 WJF00083 5.510 6.103 CV-4500 AVANT 3744284509 2934506987 100062206 00039341 GDMT28Y3ESF
4 WJRP2660 WJF00084 6.0 6.103 CV-4500 AVANT 2365986521 1476212857 100042205 00039348 G2GY4SY3ESF
5 WJRP2659 WJF00159 6.0 6.103 CV-4500 AVANT 2709054503 3974839712 100072210 00040145 G5PRTW04ESF
6 WJF00545 WJF00197 6.213 6.104 AVANT 3878777362 1191612605 300022404 00041459 GHNWYRT3ESF
7 WJRP3638 WJF00450 5.602 6.204 CV-4500 AVANT 0720778210 MISSING_DATA 400052411 MISSING_DATA G8KRCPZ3ESF DO NOT MIGRATE - user_id + hw_id need dongle read
8 WJF00052 WJF00461 6.103 6.213 AVANT 3270314998 3878777362 400012504 00044757 G2PMG3D4ESF new bay (was misattributed to WJF00545 in old CSV)
9 WJF00084 WJF00545 6.103 6.213 AVANT 1476212857 3268459559 500022512 00045652 G6MJG3D4ESF user_id refreshed 2026-05-24 (was 3878777362)
10 WJF00083 WJRP0423 6.103 6.0 AVANT CV-3100 2934506987 3669340917 720104 00025834 GGDBWRT3ESF old bay - device-map name 'NewCVSV' is Mitutoyo internal for CV-3100
11 WJRP3025 WJRP2035 6.0 CV-3200 CV-4500 2292822471 200011406 0008232 G6W7JK44ESF live binary is 5.7.0.82 - migrating to original 6.0 target
12 WJF00197 WJRP2335 6.104 6.0 AVANT CV-4500 1191612605 1780916688 800011510 00011911 G4B48FZ3ESF live binary is 5.7.0.82 - migrating to original 6.0 target
13 WJRP4802 WJRP2347 6.002 6.0 AVANT CV-4500 0920866935 3585172946 800021510 00011674 GDR6B8B3ESF live binary is 5.7.0.82 - migrating to original 6.0 target
14 WJRP2347 WJRP2659 6.0 CV-4500 3585172946 2709054503 000021608 00015700 G33N20R3ESF live binary is 5.7.0.82 - migrating to original 6.0 target
15 WJRP2035 WJRP2660 6.0 CV-4500 2292822471 236598621 000011607 00015588 GGGMF1V3ESF live binary is 5.7.0.92 - migrating to original 6.0 target
16 WJRP2335 WJRP3638 6.0 5.602 CV-4500 1780916688 0720778210 400031808 00024395 GFDBWRT3ESF
17 WJRP3689 5.510 CV-4500 3744284509 400021807f 00024390 G4HCKF33ESF live binary is 5.6.0.40 (release 5.602) - migrating to original 5.510 target
18 WJRP4802 6.002 AVANT 0920866935 100062108 00034683 G5W7R704ESF live binary is 5.7.0.92 - migrating to original 6.002 target

View File

@@ -214,7 +214,7 @@ REM net use Y: will be a no-op if Y: is already mapped.
net use Y: \\172.16.9.1\enrollment /user:pxe-upload pxe /persistent:no >NUL 2>NUL
del X:\waxtrace-asset.txt 2>NUL
if not exist "Y:\installers-post\waxtrace\select-waxtrace-asset.ps1" goto waxtrace_picker_skip
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "Y:\installers-post\waxtrace\select-waxtrace-asset.ps1" -IndexPath "Y:\installers-post\waxtrace\calibrations\INDEX.csv" -OutFile "X:\waxtrace-asset.txt"
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "Y:\installers-post\waxtrace\select-waxtrace-asset.ps1" -IndexPath "Y:\installers-post\waxtrace\bay-config.csv" -OutFile "X:\waxtrace-asset.txt"
:waxtrace_picker_skip
set MACHINENUM=
if exist X:\waxtrace-asset.txt set /p MACHINENUM=<X:\waxtrace-asset.txt