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)
|
||||
|
||||
@@ -61,11 +61,21 @@ foreach ($c in $copies) {
|
||||
}
|
||||
}
|
||||
|
||||
# --- 3. Set DNC site ---
|
||||
# --- 3. Set DNC site + machine number ---
|
||||
$regBase = "HKLM\SOFTWARE\WOW6432Node\GE Aircraft Engines\DNC"
|
||||
reg add "$regBase\General" /v Site /t REG_SZ /d $siteNameCompact /f | Out-Null
|
||||
Write-Host " DNC site set to $siteNameCompact."
|
||||
|
||||
# Set machine number if tech entered one during PXE menu (defaults to 9999)
|
||||
$machineNumFile = 'C:\Enrollment\machine-number.txt'
|
||||
$machineNum = '9999'
|
||||
if (Test-Path -LiteralPath $machineNumFile) {
|
||||
$num = (Get-Content -LiteralPath $machineNumFile -First 1 -ErrorAction SilentlyContinue).Trim()
|
||||
if ($num -and $num -match '^\d+$') { $machineNum = $num }
|
||||
}
|
||||
reg add "$regBase\General" /v MachineNo /t REG_SZ /d $machineNum /f | Out-Null
|
||||
Write-Host " DNC MachineNo set to $machineNum."
|
||||
|
||||
# --- 4. Deploy custom eMxInfo.txt to both Program Files paths ---
|
||||
if (Test-Path $emxInfo) {
|
||||
$dest86 = "C:\Program Files (x86)\DNC\Server Files"
|
||||
|
||||
@@ -122,6 +122,13 @@ set /p standard_choice=Enter your choice (1-2):
|
||||
if "%standard_choice%"=="1" set PCSUBTYPE=Timeclock
|
||||
if "%standard_choice%"=="2" set PCSUBTYPE=Machine
|
||||
if "%PCSUBTYPE%"=="" goto standard_menu
|
||||
|
||||
REM --- Machine number (Standard only) ---
|
||||
set MACHINENUM=9999
|
||||
echo.
|
||||
set /p MACHINENUM=Enter machine number (digits, or Enter for 9999):
|
||||
if "%MACHINENUM%"=="" set MACHINENUM=9999
|
||||
echo Machine number: %MACHINENUM%
|
||||
:skip_standard_menu
|
||||
|
||||
REM --- Display sub-type ---
|
||||
@@ -278,6 +285,7 @@ if "%PCTYPE%"=="" goto cleanup_enroll
|
||||
echo %PCTYPE%> W:\Enrollment\pc-type.txt
|
||||
if not "%DISPLAYTYPE%"=="" echo %DISPLAYTYPE%> W:\Enrollment\display-type.txt
|
||||
if not "%PCSUBTYPE%"=="" echo %PCSUBTYPE%> W:\Enrollment\pc-subtype.txt
|
||||
if not "%MACHINENUM%"=="" echo %MACHINENUM%> W:\Enrollment\machine-number.txt
|
||||
copy /Y "Y:\shopfloor-setup\Run-ShopfloorSetup.ps1" "W:\Enrollment\Run-ShopfloorSetup.ps1"
|
||||
REM --- Always copy Shopfloor baseline scripts ---
|
||||
mkdir W:\Enrollment\shopfloor-setup 2>NUL
|
||||
|
||||
Reference in New Issue
Block a user