Last active
September 12, 2019 21:13
-
-
Save skive/6b6c4991e9dc47c8292bef737de6b92f to your computer and use it in GitHub Desktop.
Remove erroneous Hyper-V network adapters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Should be run under SYSTEM user | |
$Devs = Get-PnpDevice -class net | ? Status -eq Error | Select FriendlyName,InstanceId | |
ForEach ($Dev in $Devs) { | |
Write-Host "Incorrect device $($Dev.FriendlyName) $($Dev.InstanceId)" -ForegroundColor Yellow | |
$RemoveKey = "HKLM:\SYSTEM\CurrentControlSet\Enum\$($Dev.InstanceId)" | |
Write-Host "Removing ${RemoveKey}..." -ForegroundColor White | |
Get-Item $RemoveKey | Select-Object -ExpandProperty Property | %{ Remove-ItemProperty -Path $RemoveKey -Name $_ -Verbose } | |
} | |
Write-Host "Done. Please restart." -ForegroundColor Green |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment