From e8728206bec9b945c4266f72b4f8b3b4f83ff7e0 Mon Sep 17 00:00:00 2001 From: Latte Date: Mon, 2 Mar 2026 10:40:33 +0000 Subject: [PATCH] Add autopilot-online.ps1 --- autopilot-online.ps1 | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 autopilot-online.ps1 diff --git a/autopilot-online.ps1 b/autopilot-online.ps1 new file mode 100644 index 0000000..1d4407e --- /dev/null +++ b/autopilot-online.ps1 @@ -0,0 +1,34 @@ +# ============================== +# Windows Autopilot Online Upload Script +# ============================== + +Write-Host "Starting Autopilot registration..." -ForegroundColor Cyan + +# Force TLS 1.2 (prevents PSGallery errors) +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + +# Temporarily bypass execution policy for this session only +Set-ExecutionPolicy Bypass -Scope Process -Force + +# Install NuGet provider silently if missing +if (!(Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) { + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force +} + +# Trust PSGallery to avoid confirmation prompts +Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted + +# Install Get-WindowsAutopilotInfo if not present +if (!(Get-Command Get-WindowsAutoPilotInfo.ps1 -ErrorAction SilentlyContinue)) { + Install-Script -Name Get-WindowsAutoPilotInfo -Force +} + +# OPTIONAL: Set GroupTag here (edit if needed) +$GroupTag = "Surface-2026" + +# Run upload +Write-Host "Uploading hardware hash to Intune..." -ForegroundColor Yellow + +Get-WindowsAutoPilotInfo.ps1 -Online -GroupTag $GroupTag + +Write-Host "Autopilot registration completed." -ForegroundColor Green \ No newline at end of file