Renumber PXE LAN from 10.9.100.0/24 to 172.16.9.0/24

Single-site bay-stuck issue at WJ: GE Intune Report IP script filters
Get-NetIPAddress on StartsWith("10.") and posts everything matching
to the GE Tines webhook. Bays at WJ get the PXE LAN 10.9.100.x IP
captured and reported -> GE backend tags bays as on a non-corp 10.x
subnet -> dynamic group eligibility for SFLD policy never matches.
Other GE sites work because their PXE LANs aren't on 10.x at all.

Renumber PXE LAN to RFC1918 172.16.9.0/24 so the GE filter naturally
skips wired PXE addresses without any disable-NIC dance.

Server-side already in flight (netplan dual-bound, dnsmasq scope +
boot URL repointed, blancco preferences + grub.cfg + iPXE GetPxeScript
all sed'd to 172.16.9.1). This commit is the playbook / scripts /
docs side: 109 hits across 35 files sed'd in one shot.

After this lands + boot.wim is rebuilt + bays renumber off DHCP,
the 10.9.100.1 binding will be dropped from netplan as the final
cleanup step.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-05-14 16:30:32 -04:00
parent c6b249f866
commit ce604adcda
87 changed files with 697 additions and 139 deletions

View File

@@ -23,7 +23,7 @@
Output lands under C:\ProgramData\state-<stage>-<timestamp>\.
Copy the whole folder back to the workstation
(\\10.9.100.1\image-upload or dump to pxe-images manually) and diff.
(\\172.16.9.1\image-upload or dump to pxe-images manually) and diff.
Diffing tips:
pre-category -> post-category : what the category-driven Intune
@@ -175,6 +175,189 @@ Step "dsregcmd /status" {
dsregcmd /status 2>&1 | Out-File "$out\dsregcmd.txt"
}
# --- Intune readiness probe (4-layer gate, frozen at this snapshot moment).
# Aligned with Microsoft's documented IME / ESP gates - see:
# https://learn.microsoft.com/en-us/windows/client-management/mdm-diagnose-enrollment
# https://patchmypc.com/blog/intune-management-extension-esp-phases/
#
# Layer 1 - AAD + MDM enrollment object exists
# AzureAdJoined, IntuneEnrolled (HKLM\Enrollments\<GUID> EnrollmentState=1)
# Layer 2 - Microsoft's own success markers
# MdmEnrollEvent75Found ("Auto MDM Enroll: Succeeded" in DeviceManagement-Enterprise-Diagnostics-Provider/Admin)
# No MdmEnrollEvent76Found (failure) within last 7d
# HasProvisioningCompleted=1 in OMADM\Accounts\<id>
# FirstSync IsSyncDone=1 in Enrollments\<id>\FirstSync
# Layer 3 - Policy actually delivered (CSP succeeded, not just provider registered)
# PolicyManager\Providers\<EnrollmentId>\default\Device exists
# PolicyManager\current\device has subkeys
# Layer 4 - IME running (Win32App / PowerShell channel ready)
# IME service running, IME log dir populated
# Sidecar Policy Provider InstallationState=Completed (best-effort log grep)
#
# Pre-category snapshots that show layers 2-3 red = category assigned too
# early -> reboot races the policy/payload pull -> stalled deploy -> re-image.
Step "intune category-readiness probe" {
$r = [ordered]@{
# Layer 1
AzureAdJoined = $false
AzureAdTenant = $null
DeviceId = $null
IntuneEnrolled = $false
EnrollmentId = $null
# Layer 2
MdmEnrollEvent75Found = $false
MdmEnrollEvent75Time = $null
MdmEnrollEvent76Found = $false
MdmEnrollEvent76Time = $null
HasProvisioningCompleted = $false
FirstSyncIsSyncDone = $false
# Layer 3
PolicyManagerProviderForEnrollment = $false
PolicyManagerCurrentDeviceSubkeys = 0
# Layer 4
ImeServiceRunning = $false
ImeLogDirPopulated = $false
SidecarInstallationState = $null # 'Completed' | 'InProgress' | $null
# Misc
LastSyncEventTime = $null
Stage = $Stage
SnapshotTime = $null
}
# Layer 1: AAD + tenant + DeviceId
try {
$ds = & dsregcmd /status 2>&1 | Out-String
if ($ds -match 'AzureAdJoined\s*:\s*YES') { $r.AzureAdJoined = $true }
if ($ds -match 'TenantId\s*:\s*(\S+)') { $r.AzureAdTenant = $matches[1] }
if ($ds -match '(?m)^\s*DeviceId\s*:\s*(\S+)') { $r.DeviceId = $matches[1] }
} catch {}
# Layer 1: enrollment record
try {
$eks = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Enrollments' -ErrorAction SilentlyContinue |
Where-Object {
$p = Get-ItemProperty $_.PSPath -ErrorAction SilentlyContinue
$p -and $p.EnrollmentState -eq 1 -and $_.PSChildName -ne 'Context'
}
if ($eks) {
$r.IntuneEnrolled = $true
$r.EnrollmentId = $eks[0].PSChildName
}
} catch {}
# Layer 2: event 75 (success) + 76 (failure) in last 7d
try {
$cutoff = (Get-Date).AddDays(-7)
$evts = Get-WinEvent -LogName 'Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin' -MaxEvents 1000 -ErrorAction SilentlyContinue |
Where-Object { $_.TimeCreated -gt $cutoff }
$e75 = $evts | Where-Object { $_.Id -eq 75 } | Sort-Object TimeCreated -Descending | Select-Object -First 1
$e76 = $evts | Where-Object { $_.Id -eq 76 } | Sort-Object TimeCreated -Descending | Select-Object -First 1
if ($e75) { $r.MdmEnrollEvent75Found = $true; $r.MdmEnrollEvent75Time = $e75.TimeCreated.ToString('o') }
if ($e76) { $r.MdmEnrollEvent76Found = $true; $r.MdmEnrollEvent76Time = $e76.TimeCreated.ToString('o') }
$latest = $evts | Sort-Object TimeCreated -Descending | Select-Object -First 1
if ($latest) { $r.LastSyncEventTime = $latest.TimeCreated.ToString('o') }
} catch {}
# Layer 2 + 3: per-enrollment regs (only meaningful with an EnrollmentId)
if ($r.EnrollmentId) {
try {
$omadm = "HKLM:\SOFTWARE\Microsoft\Provisioning\OMADM\Accounts\$($r.EnrollmentId)"
if (Test-Path $omadm) {
$v = (Get-ItemProperty -Path $omadm -Name HasProvisioningCompleted -ErrorAction SilentlyContinue).HasProvisioningCompleted
if ($v -eq 1) { $r.HasProvisioningCompleted = $true }
}
} catch {}
try {
$fs = "HKLM:\SOFTWARE\Microsoft\Enrollments\$($r.EnrollmentId)\FirstSync"
if (Test-Path $fs) {
$v = (Get-ItemProperty -Path $fs -Name IsSyncDone -ErrorAction SilentlyContinue).IsSyncDone
if ($v -eq 1) { $r.FirstSyncIsSyncDone = $true }
}
} catch {}
try {
$pp = "HKLM:\SOFTWARE\Microsoft\PolicyManager\Providers\$($r.EnrollmentId)\default\Device"
if (Test-Path $pp) { $r.PolicyManagerProviderForEnrollment = $true }
} catch {}
}
# Layer 3: actual policy mirror under current\device
try {
$cur = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device' -ErrorAction SilentlyContinue
$r.PolicyManagerCurrentDeviceSubkeys = if ($cur) { $cur.Count } else { 0 }
} catch {}
# Layer 4: IME service + logs
try {
$svc = Get-Service -Name 'IntuneManagementExtension' -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -eq 'Running') { $r.ImeServiceRunning = $true }
$imeLog = 'C:\ProgramData\Microsoft\IntuneManagementExtension\Logs'
if ((Test-Path $imeLog) -and (Get-ChildItem $imeLog -ErrorAction SilentlyContinue | Select-Object -First 1)) {
$r.ImeLogDirPopulated = $true
}
} catch {}
# Layer 4: Sidecar Policy Provider InstallationState (best-effort grep of IME log)
try {
$imeLogFile = 'C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\IntuneManagementExtension.log'
if (Test-Path $imeLogFile) {
$hits = Select-String -Path $imeLogFile -Pattern 'Sidecar.*?[Ii]nstallation\s*[Ss]tate.*?(Completed|InProgress|NotStarted|Failed)' -ErrorAction SilentlyContinue |
Select-Object -Last 1
if ($hits -and $hits.Matches.Count -gt 0 -and $hits.Matches[0].Groups.Count -ge 2) {
$r.SidecarInstallationState = $hits.Matches[0].Groups[1].Value
}
}
} catch {}
# Verdict
$r.SnapshotTime = (Get-Date).ToString('o')
$r.ReadyForCategoryAssignment = (
$r.AzureAdJoined -and
$r.IntuneEnrolled -and
$r.MdmEnrollEvent75Found -and
(-not $r.MdmEnrollEvent76Found) -and
$r.HasProvisioningCompleted -and
$r.FirstSyncIsSyncDone -and
$r.PolicyManagerProviderForEnrollment -and
($r.PolicyManagerCurrentDeviceSubkeys -gt 0) -and
$r.ImeServiceRunning -and
$r.ImeLogDirPopulated
)
[pscustomobject]$r | ConvertTo-Json -Depth 3 | Out-File "$out\intune-readiness.json"
# Human-readable summary (PS 5.1-safe: $(if ...) subexpressions, no inline-if-as-expression)
@(
"Intune category-readiness probe @ $($r.SnapshotTime) (stage=$Stage)"
'------------------------------------------------------------------'
' Layer 1 - AAD + MDM enrollment object'
(" [{0}] AzureAdJoined tenant={1}" -f $(if ($r.AzureAdJoined) {'OK '} else {'FAIL'}), $r.AzureAdTenant)
(" [{0}] IntuneEnrolled id={1}" -f $(if ($r.IntuneEnrolled) {'OK '} else {'FAIL'}), $r.EnrollmentId)
' Layer 2 - Microsoft success markers'
(" [{0}] Event 75 (Auto MDM Enroll: Succeeded) time={1}" -f $(if ($r.MdmEnrollEvent75Found) {'OK '} else {'FAIL'}), $r.MdmEnrollEvent75Time)
(" [{0}] No event 76 in last 7d (no enroll failure) lastFail={1}" -f $(if ($r.MdmEnrollEvent76Found) {'FAIL'} else {'OK '}), $r.MdmEnrollEvent76Time)
(" [{0}] OMADM HasProvisioningCompleted=1" -f $(if ($r.HasProvisioningCompleted) {'OK '} else {'FAIL'}))
(" [{0}] Enrollments\<id>\FirstSync IsSyncDone=1" -f $(if ($r.FirstSyncIsSyncDone) {'OK '} else {'FAIL'}))
' Layer 3 - policy actually delivered'
(" [{0}] PolicyManager\Providers\<EnrollmentId>\default\Device exists" -f $(if ($r.PolicyManagerProviderForEnrollment) {'OK '} else {'FAIL'}))
(" [{0}] PolicyManager\current\device subkey count={1}" -f $(if ($r.PolicyManagerCurrentDeviceSubkeys -gt 0) {'OK '} else {'FAIL'}), $r.PolicyManagerCurrentDeviceSubkeys)
' Layer 4 - IME running (Win32App / PS1 channel)'
(" [{0}] IME service running" -f $(if ($r.ImeServiceRunning) {'OK '} else {'FAIL'}))
(" [{0}] IME log dir populated" -f $(if ($r.ImeLogDirPopulated) {'OK '} else {'FAIL'}))
(" [--] Sidecar InstallationState (best-effort) value={0}" -f $(if ($r.SidecarInstallationState) { $r.SidecarInstallationState } else { '(unknown)' }))
'------------------------------------------------------------------'
("ReadyForCategoryAssignment: $($r.ReadyForCategoryAssignment)")
("DeviceId: $($r.DeviceId)")
("LastMDMEvent: $($r.LastSyncEventTime)")
''
'Notes:'
' - All layers must be green before assigning device category in Intune.'
' - Even when ready locally, allow >=15 min after adding the user/device'
' to the target Entra group (server-side group eval delay, MS docs).'
' - Pre-category snapshot with red Layer 2/3 = root cause for "imaging'
' stalled and required re-image" (category raced the policy pull).'
) | Out-File "$out\intune-readiness.txt"
}
# --- SFLD credential manager YAML (identifies the Intune category)
Step "snapshot SFLD CredentialManager dir" {
$cmDir = 'C:\ProgramData\SFLD\CredentialManager'
@@ -291,6 +474,6 @@ Write-Host ""
Write-Host "Snapshot complete: $out"
Write-Host ""
Write-Host "Next: copy that folder to the workstation. Easiest:"
Write-Host " net use Z: \\10.9.100.1\image-upload /user:pxe-upload pxe /persistent:no"
Write-Host " net use Z: \\172.16.9.1\image-upload /user:pxe-upload pxe /persistent:no"
Write-Host " robocopy `"$out`" `"Z:\state-$Stage-$stamp`" /E /NFL /NDL /NJH /NJS"
Write-Host " net use Z: /delete /y"