Run-ShopfloorSetup.ps1 now checks for C:\Enrollment\setup-stage.txt at the very top. If the stage file exists (written by run-enrollment.ps1), the script exits immediately with "deferring to Stage-Dispatcher.ps1 on next logon". This prevents the unattend's FirstLogonCommands chain from running Run-ShopfloorSetup in the same session as run-enrollment, which was bypassing the entire staged reboot chain. Without this gate: FirstLogonCommand #1: run-enrollment.ps1 (sets stage file + RunOnce) FirstLogonCommand #2: Run-ShopfloorSetup.ps1 (runs immediately, ignoring stage) PPKG reboot fires after both complete Next boot: dispatcher has nothing to do (Run-ShopfloorSetup already ran) With the gate: FirstLogonCommand #1: run-enrollment.ps1 (sets stage file + RunOnce) FirstLogonCommand #2: Run-ShopfloorSetup.ps1 (sees stage file, exits) PPKG reboot fires Next boot: RunOnce fires dispatcher, reads "shopfloor-setup", runs Run-ShopfloorSetup properly (stage file deleted by gate on re-entry) Also: Monitor-IntuneProgress.ps1 RetriggerMinutes bumped from 3 to 5. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8.5 KiB
8.5 KiB