Monitor: bump post-reEnable settle 1s->5s + retry idx=7 push
Field test: bay imaged end-to-end, Monitor saw Report IP log, captured DeviceId (Phase 1 went COMPLETE on screen + QR rendered from dsregcmd), but the idx=7 push to the PXE dashboard never landed before the Intune-triggered LAPS-prompt reboot. Root cause: Enable-NetAdapter + 1s sleep doesn't give Windows time to renew DHCP + populate routes before Send-PxeStatus POSTs to PXE webapp. Push silently caught (Send-PxeStatus has try/catch), next tick was 30s away, LAPS reboot fired in between. Two changes: 1. Sleep bumped 1s -> 5s after Enable-NetAdapter so wired path is actually carrying traffic before we POST. 2. When the tick that did the re-enable is also the push tick, retry Send-PxeStatus up to 6 times with 2s spacing (~12s total) instead of one-shot-then-give-up. Surfaces the warning to the transcript if all attempts fail so we can diagnose next time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -232,6 +232,7 @@ function Get-Phase1 {
|
||||
$reportIpLog = Get-ChildItem -Path 'C:\Logs\GE_Report_IP_Address*' -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
$nicListFile = 'C:\Enrollment\disabled-wired-nics.txt'
|
||||
$justReEnabled = $false
|
||||
if ($reportIpLog -and (Test-Path $nicListFile)) {
|
||||
try {
|
||||
$nicNames = Get-Content $nicListFile -ErrorAction Stop
|
||||
@@ -240,8 +241,13 @@ function Get-Phase1 {
|
||||
try { Enable-NetAdapter -Name $n -Confirm:$false -ErrorAction Stop }
|
||||
catch { Write-Warning "Enable-NetAdapter '$n' failed: $_" }
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
# Wait for DHCP renewal + route table update + reachability to
|
||||
# PXE server. 1 second wasn't enough in field testing - the
|
||||
# subsequent idx=7 push fired into the void before the wired
|
||||
# NIC was carrying traffic.
|
||||
Start-Sleep -Seconds 5
|
||||
Remove-Item $nicListFile -Force -ErrorAction SilentlyContinue
|
||||
$justReEnabled = $true
|
||||
} catch {
|
||||
Write-Warning "Re-enable wired NICs failed: $_"
|
||||
}
|
||||
@@ -249,15 +255,26 @@ function Get-Phase1 {
|
||||
|
||||
# Push DeviceId / idx=7 once, when both DeviceId is captured and the
|
||||
# Report IP log has landed (dashboard QR renders from DeviceId).
|
||||
# Retry up to 6x with backoff because the imminent LAPS-prompt reboot
|
||||
# gives us only seconds and the wired NIC may still be settling.
|
||||
if ($script:cache.DeviceId -and -not $script:cache.DeviceIdReported -and $reportIpLog) {
|
||||
Ensure-SendPxeStatus
|
||||
if (Get-Command Send-PxeStatus -ErrorAction SilentlyContinue) {
|
||||
try {
|
||||
Send-PxeStatus -Stage 'Monitor-IntuneProgress: Intune Device ID captured' `
|
||||
-StageIndex 7 -StageTotal 8 `
|
||||
-IntuneDeviceId $script:cache.DeviceId
|
||||
$script:cache.DeviceIdReported = $true
|
||||
} catch { }
|
||||
$attempts = if ($justReEnabled) { 6 } else { 1 }
|
||||
for ($i = 0; $i -lt $attempts; $i++) {
|
||||
$err = $null
|
||||
try {
|
||||
Send-PxeStatus -Stage 'Monitor-IntuneProgress: Intune Device ID captured' `
|
||||
-StageIndex 7 -StageTotal 8 `
|
||||
-IntuneDeviceId $script:cache.DeviceId -ErrorAction Stop
|
||||
$script:cache.DeviceIdReported = $true
|
||||
break
|
||||
} catch { $err = $_ }
|
||||
if ($i -lt $attempts - 1) { Start-Sleep -Seconds 2 }
|
||||
}
|
||||
if (-not $script:cache.DeviceIdReported -and $err) {
|
||||
Write-Warning "idx=7 push failed after $attempts attempts: $err"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user