Add bay picker (same arrow-key pattern as waxtrace) that maps CMM1-12
to a PC-DMIS version (2016/2019/2026) and DODA flag via cmm-bay-config.csv.
startnet.cmd: replace Standard/DODA submenu with bay picker. Writes
CMMID (e.g. CMM4) to machine-number.txt so the existing
TargetMachineNumbers filter on the SFLD share manifest gates per-bay
entries with no lib changes.
09-Setup-CMM: reads resolved version.txt and filters cmm-manifest.json
by _CmmVersion tag at imaging time so only the matched PC-DMIS version
installs.
cmm-manifest.json: add PC-DMIS 2026.1 entry (patched MSI, product code
{81BACE1B-FB08-4DCF-8100-79911AD3EC1E}) and DODA entry (flat zip extract
to C:\Apps\DODA\). Existing 2016/2019 entries tagged with _CmmVersion.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
111 lines
3.3 KiB
PowerShell
111 lines
3.3 KiB
PowerShell
# select-cmm-bay.ps1 - Arrow-key CMM bay picker for imaging.
|
|
#
|
|
# Reads cmm-bay-config.csv from the PXE enrollment share and presents
|
|
# a menu of CMM1-CMM12 with their PC-DMIS version and DODA flag.
|
|
# Writes the selected CMM ID to $OutFile for startnet.cmd to read back.
|
|
#
|
|
# Also writes resolved config files so 09-Setup-CMM.ps1 can gate installs:
|
|
# C:\Enrollment\cmm\version.txt (e.g. "2019")
|
|
# C:\Enrollment\cmm\doda.txt (e.g. "yes" or "no")
|
|
#
|
|
# Exit codes:
|
|
# 0 = CMM ID written to $OutFile
|
|
# 1 = user cancelled (Esc)
|
|
# 2 = CSV unreadable AND no fallback entered
|
|
|
|
param(
|
|
[string]$ConfigPath = 'Y:\installers-post\cmm\cmm-bay-config.csv',
|
|
[Parameter(Mandatory=$true)][string]$OutFile
|
|
)
|
|
|
|
$ErrorActionPreference = 'Continue'
|
|
|
|
function Read-BayList {
|
|
param([string]$Path)
|
|
if (-not (Test-Path -LiteralPath $Path)) { return @() }
|
|
try {
|
|
return Import-Csv -LiteralPath $Path | Sort-Object {
|
|
if ($_.cmm_id -match '(\d+)$') { [int]$Matches[1] } else { 999 }
|
|
}
|
|
} catch {
|
|
return @()
|
|
}
|
|
}
|
|
|
|
function Show-Menu {
|
|
param(
|
|
[object[]]$Items,
|
|
[int]$Selected,
|
|
[string]$Title
|
|
)
|
|
Clear-Host
|
|
Write-Host ""
|
|
Write-Host " ========================================"
|
|
Write-Host " $Title"
|
|
Write-Host " ========================================"
|
|
Write-Host ""
|
|
Write-Host " Up / Down arrows = navigate, Enter = select, Esc = cancel"
|
|
Write-Host ""
|
|
for ($i = 0; $i -lt $Items.Count; $i++) {
|
|
$item = $Items[$i]
|
|
if ($item -is [string]) {
|
|
$line = $item
|
|
} else {
|
|
$dodaLabel = if ($item.doda -ieq 'yes') { '+ DODA' } else { '' }
|
|
$line = "{0,-8} PC-DMIS {1,-6} {2}" -f $item.cmm_id, $item.pcdmis_version, $dodaLabel
|
|
}
|
|
if ($i -eq $Selected) {
|
|
Write-Host (" > " + $line) -ForegroundColor Black -BackgroundColor White
|
|
} else {
|
|
Write-Host (" " + $line)
|
|
}
|
|
}
|
|
}
|
|
|
|
$bays = @(Read-BayList -Path $ConfigPath)
|
|
if ($bays.Count -eq 0) {
|
|
Write-Host "WARNING: Could not read $ConfigPath"
|
|
}
|
|
|
|
$menuItems = @($bays) + @("Other (manual entry)")
|
|
$selected = 0
|
|
|
|
while ($true) {
|
|
Show-Menu -Items $menuItems -Selected $selected -Title "Select CMM Bay"
|
|
$key = [System.Console]::ReadKey($true)
|
|
switch ($key.Key) {
|
|
'UpArrow' { if ($selected -gt 0) { $selected-- } }
|
|
'DownArrow' { if ($selected -lt ($menuItems.Count - 1)) { $selected++ } }
|
|
'Enter' { break }
|
|
'Escape' { Write-Host "`n Cancelled."; exit 1 }
|
|
}
|
|
if ($key.Key -eq 'Enter') { break }
|
|
}
|
|
|
|
$chosen = $menuItems[$selected]
|
|
|
|
if ($chosen -is [string]) {
|
|
Write-Host ""
|
|
$manual = Read-Host " Enter CMM ID (e.g. CMM1)"
|
|
if (-not $manual) {
|
|
Write-Host " No CMM ID entered."
|
|
exit 2
|
|
}
|
|
$cmmId = $manual.Trim().ToUpper()
|
|
$match = $bays | Where-Object { $_.cmm_id -ieq $cmmId }
|
|
if ($match) {
|
|
$chosen = $match
|
|
} else {
|
|
Write-Host " $cmmId not in bay-config. Writing ID only (no version/doda resolution)."
|
|
[System.IO.File]::WriteAllText($OutFile, $cmmId)
|
|
exit 0
|
|
}
|
|
}
|
|
|
|
$cmmId = $chosen.cmm_id.Trim().ToUpper()
|
|
[System.IO.File]::WriteAllText($OutFile, $cmmId)
|
|
Write-Host ""
|
|
Write-Host " Selected: $cmmId (PC-DMIS $($chosen.pcdmis_version), DODA=$($chosen.doda))"
|
|
|
|
exit 0
|