Realtek RTL8852BE describes itself as 'Realtek RTL8852BE WiFi 6 802.11ax PCIe Adapter' -- no hyphen in 'WiFi' -- which the previous regex 'Wi-Fi|Wireless' rejected. migrate-to-wifi.ps1's gate then exited 0 silently and neither wired NIC got disabled, leaving the imaging chain running over PXE ethernet for the entire PPKG phase. New regex Wi-?Fi|Wireless|WLAN|802\.11 covers: - Wi-Fi (Intel-style with hyphen) - WiFi (Realtek-style without hyphen) - Wireless (Intel Wireless-AC, Killer Wireless) - WLAN (some Realtek/MediaTek variants) - 802.11 (vendor-agnostic spec reference, fallback) Applied in two callers: - migrate-to-wifi.ps1 (3 occurrences: gate + disable + re-enable on timeout) - Monitor-IntuneProgress.ps1 (re-enable wired on sync_intune startup) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
1.6 KiB
PowerShell
44 lines
1.6 KiB
PowerShell
# migrate-to-wifi.ps1 - Invoked by FlatUnattendW10-shopfloor.xml as Order 5
|
|
# during first logon, right after wait-for-internet.ps1 and right before
|
|
# GCCH enrollment. Moves the machine off wired onto WiFi for the rest of
|
|
# the imaging chain so the PXE ethernet cable can be safely disconnected.
|
|
#
|
|
# Gated: if there is no physical Wi-Fi adapter on the machine (tower /
|
|
# desktop case), the whole migration is a no-op. Previously this step
|
|
# disabled all wired adapters unconditionally and then waited for WiFi
|
|
# internet that could never arrive on towers, hanging first logon forever.
|
|
|
|
$wifi = Get-NetAdapter -Physical -ErrorAction SilentlyContinue |
|
|
Where-Object { $_.InterfaceDescription -match 'Wi-?Fi|Wireless|WLAN|802\.11' }
|
|
|
|
if (-not $wifi) {
|
|
Write-Host 'No WiFi adapter - staying on ethernet.' -ForegroundColor Cyan
|
|
exit 0
|
|
}
|
|
|
|
Get-NetAdapter -Physical |
|
|
Where-Object { $_.InterfaceDescription -notmatch 'Wi-?Fi|Wireless|WLAN|802\.11' } |
|
|
Disable-NetAdapter -Confirm:$false
|
|
|
|
$deadline = (Get-Date).AddMinutes(5)
|
|
$ok = $false
|
|
while ((Get-Date) -lt $deadline) {
|
|
try {
|
|
if (Test-NetConnection -ComputerName login.microsoftonline.us -Port 443 -InformationLevel Quiet -WarningAction SilentlyContinue) {
|
|
$ok = $true
|
|
break
|
|
}
|
|
} catch {}
|
|
Start-Sleep -Seconds 5
|
|
}
|
|
|
|
if ($ok) {
|
|
Write-Host 'Internet confirmed over WiFi.' -ForegroundColor Green
|
|
} else {
|
|
Write-Host 'WiFi internet timeout - re-enabling ethernet.' -ForegroundColor Yellow
|
|
Get-NetAdapter -Physical |
|
|
Where-Object { $_.InterfaceDescription -notmatch 'Wi-?Fi|Wireless|WLAN|802\.11' } |
|
|
Enable-NetAdapter -Confirm:$false
|
|
}
|
|
exit 0
|