Auto-apply startup items from profile, Configure-PC -MachineNumberOnly

Three changes to eliminate the redundant startup-item picker during
the imaging chain:

06-OrganizeDesktop.ps1 - new Phase 3: auto-apply startup items
  Reads pcProfile.startupItems (or site-wide default) and creates
  .lnk files in AllUsers Startup folder. Supports exe, existing, and
  url types (same as Configure-PC). Idempotent - skips items that
  already exist so manual changes aren't overwritten. Runs during
  shopfloor setup finalization, so the tech doesn't need to select
  startup items again.

Configure-PC.ps1 - new -MachineNumberOnly switch
  When set, skips the entire startup-items section and only shows the
  machine number prompt (if UDC/eDNC at 9999). Used by sync_intune
  -AsTask after completion. Full startup picker still available when
  the tech opens Configure-PC.bat manually from the desktop.

Monitor-IntuneProgress.ps1 - simplified -AsTask completion
  After post-reboot DSC complete: unregisters task, launches
  Configure-PC -MachineNumberOnly, exits. Tech uses sync_intune.bat
  on the desktop to see QR code for inventory purposes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-04-10 14:54:31 -04:00
parent 15f67063bd
commit 07ebe819bd
3 changed files with 88 additions and 6 deletions

View File

@@ -560,15 +560,17 @@ function Invoke-SetupComplete {
Write-Host "The post-reboot DSC install phase is finished. The device is ready."
if ($AsTask) {
# Task mode: unregister our own scheduled task, launch Configure-PC
# Task mode: unregister our own scheduled task
Write-Host "Unregistering sync task..." -ForegroundColor Cyan
try {
Unregister-ScheduledTask -TaskName 'Shopfloor Intune Sync' -Confirm:$false -ErrorAction SilentlyContinue
} catch {}
# Machine number prompt only (startup items are auto-applied by
# 06-OrganizeDesktop from the PC profile). Tech can re-open
# sync_intune.bat manually to see QR code for inventory.
if ($ConfigureScript -and (Test-Path -LiteralPath $ConfigureScript)) {
Write-Host "Launching Configure-PC..." -ForegroundColor Cyan
try { & $ConfigureScript } catch { Write-Warning "Configure-PC failed: $_" }
try { & $ConfigureScript -MachineNumberOnly } catch { Write-Warning "Configure-PC failed: $_" }
}
exit 0
}