PS – Disable Unidentified network for VM nics
Wednesday, October 6th, 2010This script adds the *NdisDeviceType registry value with value 1 to the keys of the VMWare network cards.
Afterwards it disables and enables the networkcards to let the changes take effect.
$nics = gci "HKLM:\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" $nics | foreach-object -process { $devInstanceId = $_.getvalue("DeviceInstanceID") if($devInstanceId -match "VMWARE"){ Write-Host $_.Name $regpath = ( $_.name ) -replace("HKEY_LOCAL_MACHINE","HKLM:") new-itemproperty -path $regpath -name "*NdisDeviceType" -value 1 -PropertyType "DWORD" } } $wminics = get-wmiobject win32_networkadapter | where-object {$_.name -like "*vmware*" } $wminics | foreach-object -process { write-host -nonew "Disabling $($_.name) ... " $result = $_.Disable() if ($result.ReturnValue -eq -0) { write-host " success." } else { write-host " failed." } write-host -nonew "Enabling $($_.name) ... " $result = $_.Enable() if ($result.ReturnValue -eq -0) { write-host " success." } else { write-host " failed." } }