Monitor: 5s tight poll while DeviceId still missing

DeviceId may not be in dsregcmd output the moment Monitor starts after
PPKG reboot - takes a few minutes for AAD-join to settle. Default 30s
PollSecs leaves wide gaps where Monitor isn't checking. Sleep 5s
instead while DeviceIdReported is still false. Once captured + idx=7
push lands, falls back to PollSecs (30s) for the rest of the loop.

Worst case for QR-on-dashboard latency: ~5 seconds after dsregcmd
starts returning a DeviceId.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-05-14 17:08:12 -04:00
parent ab3e1c98f6
commit a9260ecadd

View File

@@ -1312,9 +1312,17 @@ try {
$nextRetrigger = $lastSync.AddMinutes($currentInterval)
}
# Tight poll while DeviceId still missing - it may take a few
# minutes after PPKG for dsregcmd to return a DeviceId, and we
# need to catch it ASAP to push idx=7 before the LAPS reboot.
# Once captured + reported, fall back to the normal cadence.
if (-not $script:cache.DeviceIdReported) {
Start-Sleep -Seconds 5
} else {
Start-Sleep -Seconds $PollSecs
}
}
}
catch {
# Any unhandled exception in the main loop lands here. Write the error
# into the transcript and then block on a keypress so the PS window