diff --git a/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 b/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 index e1137f8..1d61f85 100644 --- a/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 +++ b/playbook/shopfloor-setup/Shopfloor/lib/Monitor-IntuneProgress.ps1 @@ -636,6 +636,7 @@ function Invoke-RebootPrompt { # ============================================================================ try { $qrText = Build-QRCodeText + $qrRefreshed = [bool]($qrText -notmatch 'not yet Azure AD joined') Invoke-IntuneSync $lastSync = Get-Date $nextRetrigger = $lastSync.AddMinutes($RetriggerMinutes) @@ -643,6 +644,14 @@ try { while ($true) { $snap = Get-Snapshot + # Refresh QR code once AAD join is detected (the initial build + # may have run before enrollment completed, showing "not yet + # Azure AD joined" even after Phase 1 passes). + if (-not $qrRefreshed -and $snap.Phase1.AzureAdJoined) { + $qrText = Build-QRCodeText + $qrRefreshed = $true + } + Clear-Host Write-Host "=== Monitor running - transcript: $transcriptPath ===" -ForegroundColor DarkGray foreach ($l in (Format-Snapshot -Snap $snap -LastSync $lastSync -NextRetrigger $nextRetrigger)) {