When you use VMware, or if you have installed a Microsoft Loopback adapter, these adapters will show up in your network panel as "Unidentified Networks," and Windows assigns to them a "public network" status. That can be bad for a number of reasons. For example, when there are public networks, you cannot enable PowerShell remoting.
While you could disable all virtual network adapters, a better way is to hide them from network location awareness. Here are two functions. The first one will find a network adapter and the second one can hide the adapter from NLA:
param(
$name = "*"
)
$key = 'Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{
4D36E972-E325-11CE-BFC1-08002BE10318}\*'
Get-ItemProperty $key -ErrorAction SilentlyContinue |
Where-Object { $_.DriverDesc -like $name } |
Select-Object DriverDesc, PSPath
}
param(
[Parameter(ValueFromPipelineByPropertyName=$true)]
$PSPath,
[switch]
$ignoreNLA
)
process {
New-ItemProperty $PSPath -name '*NdisDeviceType' -propertytype dword -value 1 |
Out-Null
} else {
Remove-ItemProperty $PSPath -name '*NdisDeviceType'
}
}
}
Try this line to hide the Microsoft Loopback adapter:
You should be aware that you will need Administrator privileges to change network adapter settings. Settings will take effect once you restart the network adapter, such as by disabling and enabling or by rebooting your machine. Be careful: do not hide your regular network adapters! If you did this by accident, you can remove the registry value by running Set-NetworkAdapter without the -IgnoreNLA switch.