Run-ShopfloorSetup: vendor-agnostic wired NIC re-enable filter

Filter by PhysicalMediaType + HardwareInterface instead of
InterfaceDescription regex. Name/description varies per vendor
(Realtek Gaming GbE, Intel I219-V, etc.) so a name-only filter
missed adapters on some hardware. Keep an InterfaceDescription
negative guard for drivers that mis-report PhysicalMediaType.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-05-08 13:00:01 -04:00
parent 72e4058d89
commit 0e105fdbf2

View File

@@ -300,8 +300,21 @@ $remLog = Join-Path $imeLogs 'Autologon_Remediation.log'
if (-not (Test-Path $remLog)) { exit 0 } if (-not (Test-Path $remLog)) { exit 0 }
$content = Get-Content $remLog -Raw -ErrorAction SilentlyContinue $content = Get-Content $remLog -Raw -ErrorAction SilentlyContinue
if ($content -notmatch 'Autologon set for ShopFloor') { exit 0 } if ($content -notmatch 'Autologon set for ShopFloor') { exit 0 }
# Vendor-agnostic wired-NIC re-enable. NetAdapter "Name" varies wildly
# ("Ethernet", "Ethernet 2", "Network", per-vendor names like "Realtek
# Gaming GbE", "Intel(R) Ethernet Connection (10) I219-V") so filtering
# by Name is unreliable. Filter by PhysicalMediaType instead, with a
# keyword-negative guard for drivers that mis-report PhysicalMediaType.
# Captures Realtek, Intel, Broadcom, Marvell, Aquantia, etc.
Get-NetAdapter -Physical -ErrorAction SilentlyContinue | Get-NetAdapter -Physical -ErrorAction SilentlyContinue |
Where-Object { $_.InterfaceDescription -notmatch 'Wi-?Fi|Wireless|WLAN|802\.11' } | Where-Object {
$_.HardwareInterface -eq $true -and
$_.PhysicalMediaType -ne 'Native 802.11' -and
$_.PhysicalMediaType -ne 'Wireless WAN' -and
$_.PhysicalMediaType -ne 'BlueTooth' -and
$_.InterfaceDescription -notmatch '(?i)Wi-?Fi|Wireless|WLAN|802\.11|Bluetooth'
} |
Enable-NetAdapter -Confirm:$false -ErrorAction SilentlyContinue Enable-NetAdapter -Confirm:$false -ErrorAction SilentlyContinue
Unregister-ScheduledTask -TaskName 'GE Re-enable Wired NICs' -Confirm:$false -ErrorAction SilentlyContinue Unregister-ScheduledTask -TaskName 'GE Re-enable Wired NICs' -Confirm:$false -ErrorAction SilentlyContinue
'@ '@