Update autopilot-online.ps1

This commit is contained in:
2026-03-02 10:41:20 +00:00
parent e8728206be
commit fde68da8af

View File

@@ -1,16 +1,17 @@
# ==============================
# Windows Autopilot Online Upload Script
# No GroupTag
# ==============================
Write-Host "Starting Autopilot registration..." -ForegroundColor Cyan
Write-Host "Starting Windows Autopilot registration..." -ForegroundColor Cyan
# Force TLS 1.2 (prevents PSGallery errors)
# Force TLS 1.2 (avoids PSGallery errors)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Temporarily bypass execution policy for this session only
# Temporarily bypass execution policy (session only)
Set-ExecutionPolicy Bypass -Scope Process -Force
# Install NuGet provider silently if missing
# Install NuGet silently if missing
if (!(Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
}
@@ -18,17 +19,14 @@ if (!(Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
# Trust PSGallery to avoid confirmation prompts
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
# Install Get-WindowsAutopilotInfo if not present
# Install Get-WindowsAutoPilotInfo if not already installed
if (!(Get-Command Get-WindowsAutoPilotInfo.ps1 -ErrorAction SilentlyContinue)) {
Install-Script -Name Get-WindowsAutoPilotInfo -Force
}
# OPTIONAL: Set GroupTag here (edit if needed)
$GroupTag = "Surface-2026"
Write-Host "Generating and uploading hardware hash..." -ForegroundColor Yellow
# Run upload
Write-Host "Uploading hardware hash to Intune..." -ForegroundColor Yellow
Get-WindowsAutoPilotInfo.ps1 -Online -GroupTag $GroupTag
# Upload to tenant (login required)
Get-WindowsAutoPilotInfo.ps1 -Online
Write-Host "Autopilot registration completed." -ForegroundColor Green