@echo off REM sync_intune.bat - Thin launcher for Monitor-IntuneProgress.ps1 REM REM All polling, status display, sync triggering, and reboot detection lives in REM the PowerShell monitor. This .bat just handles: REM 1. Self-elevate to admin REM 2. Invoke the monitor (which renders QR + 5-phase status table) REM 3. Branch on the monitor's exit code: REM 0 = post-reboot install complete, "done" message and exit REM 2 = pre-reboot deployment done, prompt for reboot REM else = error, pause so the user can read it REM REM The monitor lives at C:\Enrollment\shopfloor-setup\Shopfloor\Monitor-IntuneProgress.ps1. REM This .bat gets copied to the user's desktop by Run-ShopfloorSetup.ps1, so REM %~dp0 doesn't necessarily point at the shopfloor-setup tree - we use the REM absolute path to find the monitor instead. setlocal title Intune Policy Sync set "MONITOR=C:\Enrollment\shopfloor-setup\Shopfloor\Monitor-IntuneProgress.ps1" REM Self-elevate to administrator net session >nul 2>&1 if errorlevel 1 ( powershell -Command "Start-Process '%~f0' -Verb RunAs" exit /b ) if not exist "%MONITOR%" ( echo ERROR: Monitor not found at: echo %MONITOR% echo. echo Was the shopfloor-setup tree staged correctly? pause exit /b 1 ) powershell -NoProfile -ExecutionPolicy Bypass -File "%MONITOR%" set "MONITOR_EXIT=%errorlevel%" echo. if "%MONITOR_EXIT%"=="0" ( echo ======================================== echo Setup complete - no reboot needed echo ======================================== echo. echo The post-reboot DSC install phase is finished. The device is ready. echo. pause exit /b 0 ) if "%MONITOR_EXIT%"=="2" ( echo ======================================== echo REBOOT REQUIRED echo ======================================== echo. echo The pre-reboot deployment phase is complete. You must reboot now to echo start the post-reboot DSC install phase, which downloads device-config.yaml echo and runs the per-app wrappers (Install-eDNC, Install-UDC, Install-VCRedists, echo Install-OpenText, etc). echo. choice /c YN /m "Reboot now" if errorlevel 2 ( echo Cancelled - reboot manually when ready. pause exit /b 0 ) shutdown /r /t 5 exit /b 0 ) echo ERROR: Monitor exited with code %MONITOR_EXIT% pause exit /b %MONITOR_EXIT%