Machine number input at PXE menu for Standard PCs
Adds a machine number prompt to startnet.cmd after the Standard sub-type
selection. Tech enters the number during the PXE boot process. Defaults
to 9999 if Enter is pressed (existing placeholder behavior).
Written to C:\Enrollment\machine-number.txt alongside pc-type.txt.
Consumers:
00-PreInstall-MachineApps.ps1 - replaces 9999 in UDC InstallArgs with
the entered number, so UDC installs with the correct machine number
from the start (no post-setup Set-MachineNumber needed).
01-eDNC.ps1 - writes the machine number to the DNC\General\MachineNo
registry value during eDNC install.
Configure-PC.ps1 - existing $needsMachineNumber check already skips
the prompt when UDC/eDNC aren't at 9999, so no change needed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -129,6 +129,25 @@ if ($siteConfig -and $siteConfig.siteName -and $siteConfig.siteName -ne 'West Je
|
||||
Write-PreInstallLog "No site-config override for siteName (using defaults in preinstall.json)"
|
||||
}
|
||||
|
||||
# --- Machine-number override: replace "9999" in UDC InstallArgs if tech entered a number ---
|
||||
$machineNumFile = 'C:\Enrollment\machine-number.txt'
|
||||
if (Test-Path -LiteralPath $machineNumFile) {
|
||||
$machineNum = (Get-Content -LiteralPath $machineNumFile -First 1 -ErrorAction SilentlyContinue).Trim()
|
||||
if ($machineNum -and $machineNum -ne '9999' -and $machineNum -match '^\d+$') {
|
||||
Write-PreInstallLog "Machine number from PXE menu: $machineNum"
|
||||
foreach ($app in $config.Applications) {
|
||||
if ($app.InstallArgs -and $app.InstallArgs -match '9999') {
|
||||
$app.InstallArgs = $app.InstallArgs -replace '9999', $machineNum
|
||||
Write-PreInstallLog " Overrode machine number in $($app.Name) args: $($app.InstallArgs)"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Write-PreInstallLog "Machine number: $machineNum (default placeholder)"
|
||||
}
|
||||
} else {
|
||||
Write-PreInstallLog "No machine-number.txt found (using 9999 default)"
|
||||
}
|
||||
|
||||
# --- Detection helper (mirrors Simple-Install.ps1's Test-ApplicationInstalled) ---
|
||||
function Test-AppInstalled {
|
||||
param($App)
|
||||
|
||||
Reference in New Issue
Block a user