From a9260ecadd8af027d2fd0367dc37357530011d6b Mon Sep 17 00:00:00 2001 From: cproudlock Date: Thu, 14 May 2026 17:08:12 -0400 Subject: [PATCH] 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) --- .../Shopfloor/lib/Monitor-IntuneProgress.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 b/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 index d00542c..fae2450 100644 --- a/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 +++ b/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 @@ -1312,7 +1312,15 @@ try { $nextRetrigger = $lastSync.AddMinutes($currentInterval) } - Start-Sleep -Seconds $PollSecs + # 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 {