diff --git a/playbook/shopfloor-setup/Stage-Dispatcher.ps1 b/playbook/shopfloor-setup/Stage-Dispatcher.ps1 index b9b4fde..15878d6 100644 --- a/playbook/shopfloor-setup/Stage-Dispatcher.ps1 +++ b/playbook/shopfloor-setup/Stage-Dispatcher.ps1 @@ -86,6 +86,25 @@ switch ($stage) { break } + # Defensive: top up AutoLogonCount so SupportUser keeps auto-logging + # in across any vendor-installer-forced reboots during this stage. + # The unattend XML sets LogonCount=7 at install; typical imaging burns + # through several reboots (Office, Oracle, FormTracePak forced reboot, + # Run-ShopfloorSetup explicit reboot, stage advances) and the unplanned + # FormTracePak reboot can push the counter past 0 - clearing + # AutoAdminLogon and leaving the bay parked at the login screen with + # the dispatcher unable to fire. Set the counter to 10 every time this + # stage runs so the budget is restored. When sync-intune finishes the + # whole pipeline, AutoAdminLogon is left to decrement to 0 naturally; + # by then lockdown's own Autologon.exe has taken over for ShopFloor. + try { + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' ` + -Name 'AutoLogonCount' -Value 10 -Type DWord -ErrorAction Stop + Write-Host "Topped up AutoLogonCount to 10 for SupportUser autologon resilience." + } catch { + Write-Warning "Failed to top up AutoLogonCount: $_" + } + # Defensive: re-register RunOnce BEFORE calling Run-ShopfloorSetup. # Setup chains we don't control (FormTracePak Setup.exe, eDNC MSI, # any vendor installer that forces an immediate reboot) can cut