<# Desktop Agent - device onboarding (pairing). NON-DESTRUCTIVE. Run at OOBE (Shift+F10) or on a Windows machine that has no agent yet: powershell irm https://osd.desktopagent.com | iex It downloads the runner and starts PAIRING: the machine shows a QR code. A technician scans it at m.desktopagent.com to bind this device to the right org and assign a task sequence. This command does NOT image, wipe, partition, or reboot this machine. Imaging only ever happens later, in WinPE, from the plan the platform assigns after pairing. #> $ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 try { Set-ExecutionPolicy Bypass -Scope Process -Force } catch {} $base = 'https://cdn.desktopagent.com' $work = 'C:\DA-Pair' Write-Host '' Write-Host ' Desktop Agent device pairing' -ForegroundColor Cyan Write-Host ' This shows a QR to pair the machine. It does not image or change it.' -ForegroundColor Yellow Write-Host '' $pr = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) if (-not $pr.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { throw 'Run this elevated. At OOBE use Shift+F10 (that prompt is SYSTEM).' } New-Item -ItemType Directory -Force -Path $work | Out-Null Write-Host "Downloading the runner from $base ..." Invoke-WebRequest "$base/da-runner.exe" -OutFile "$work\da-runner.exe" -UseBasicParsing Invoke-WebRequest "$base/runner.config.json" -OutFile "$work\runner.config.json" -UseBasicParsing Get-ChildItem $work -Recurse | Unblock-File -ErrorAction SilentlyContinue Write-Host '' Write-Host ' Starting pairing. Scan the QR below on your phone at m.desktopagent.com.' -ForegroundColor Cyan Write-Host '' & "$work\da-runner.exe" --pair