GE-Enforce: prefer DNC reg MachineNo over machine-number.txt

machine-number.txt holds the imaging-time MN. PCs imaged with
placeholder 9999 (tech intends to flip via Set-MachineNumber later)
keep 9999 in that file even after Update-MachineNumber writes the
real MN to HKLM:\...\Dnc\General\MachineNo. Status.json was reporting
9999 across the fleet because of this.

Now reads DNC reg first; only falls back to machine-number.txt if reg
is missing or also 9999. Existing convergence-check.txt unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-05-04 17:12:55 -04:00
parent 9b2ee11840
commit 707a0f94c2

View File

@@ -280,10 +280,26 @@ try {
} }
} }
# Prefer DNC reg (authoritative post-Update-MachineNumber) over
# machine-number.txt (imaging-time placeholder, often 9999 if tech
# imaged with placeholder + bay assignment came later).
$machineNumber = '' $machineNumber = ''
try { try {
if (Test-Path 'C:\Enrollment\machine-number.txt') { $regPaths = @(
$machineNumber = (Get-Content 'C:\Enrollment\machine-number.txt' -First 1 -ErrorAction SilentlyContinue).Trim() 'HKLM:\SOFTWARE\WOW6432Node\GE Aircraft Engines\Dnc\General',
'HKLM:\SOFTWARE\GE Aircraft Engines\Dnc\General'
)
foreach ($rp in $regPaths) {
if (Test-Path $rp) {
$v = (Get-ItemProperty -Path $rp -Name MachineNo -ErrorAction SilentlyContinue).MachineNo
if ($v -and $v -ne '9999') { $machineNumber = "$v"; break }
}
}
# Fall back to enrollment file (will be 9999 for placeholder PCs)
if (-not $machineNumber) {
if (Test-Path 'C:\Enrollment\machine-number.txt') {
$machineNumber = (Get-Content 'C:\Enrollment\machine-number.txt' -First 1 -ErrorAction SilentlyContinue).Trim()
}
} }
} catch {} } catch {}