Fix: Virtualbox causes "Unidentified" network on Vista and Windows 7
· 2010-02-15 11:33 by Thijs Kroesbergen for Brokenwire.NET
The problem:
When you install Virtualbox on Windows Vista or Windows 7 it will install an additional virtual network adapter on the host system. This “Virtualbox Host-Only Adapter” causes the Windows network detection to show an additional “unidentified” network. And while this “unidentified” network is present the windows firewall settings will stay on “Public”. This behavior is undesirable because you want to be able to switch your firewall settings based on your location (home/work/public).
The solution (manually):
WARNING; DANGER: THE REGISTRY IS NO PLAYGROUND, IF YOU DON’T UNDERSTAND WHAT YOU’RE DOING THEN DON’T DO IT!
Now we have that out of the way, here is what you should do:
1. Open regedit and navigate to HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}
2. Browse through the subkeys (named 0000, 0001, etc) until you find the subkey containing the virtualbox network adapter, this is the one where the “DriverDesc” key has “VirtualBox Host-Only Ethernet Adapter” as value.
3. Add a new DWORD value with a name of “*NdisDeviceType” and a value of “1”
4. Disable en re-enable the virtuabox host-only network adapter, or alternatively reboot your pc.
The solution (PowerShell)
I hacked together this PowerShell script to easily re-do this trick after a virtualbox upgrade. The script has only been tested on my pc (and it works), use at your own risk. You need to run an elevated PowerShell shell to modify the registry.
$devices = "HKLM:\SYSTEM\CurrentControlSet\Control\Class\*" $adapters = Get-ItemProperty $devices | Where-Object {$_.Class -eq "Net"} | Foreach-Object { $_.PSPath } Get-ChildItem $adapters -erroraction silentlycontinue | Foreach-Object { get-itemproperty -path $_.PSPath } | Where-Object {$_.ComponentId -eq "sun_vboxnetadp"} | Foreach-Object { Set-ItemProperty -path $_.PSPath -name "*NdisDeviceType" -Type DWORD -Value 1} Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like "*Virtualbox Host*"} | Foreach-Object {$_.Disable(); $_.Enable()}
Why this registry fix fixes that:
There is actually an MSDN article that describes the possible registry keys for network adapters:
*NdisDeviceType The type of the device. The default value is zero, which indicates a standard networking device that connects to a network. Set *NdisDeviceType to NDIS_DEVICE_TYPE_ENDPOINT (1) if this device is an endpoint device and is not a true network interface that connects to a network. For example, you must specify NDIS_DEVICE_TYPE_ENDPOINT for devices such as smart phones that use a networking infrastructure to communicate to the local computer system but do not provide connectivity to an external network.
And
Note Windows Vista automatically identifies and monitors the networks to which a computer connects. If the NDIS_DEVICE_TYPE_ENDPOINT flag is set, the device is an endpoint device and is not a connection to a true external network. Consequently, Windows ignores the endpoint device when Windows identifies networks. The Network Awareness APIs indicate that the device does not connect the computer to a network. For end users in this situation, the Network and Sharing Center and the network icon in the notification area do not show the NDIS endpoint device as connected. However, the connection is shown in the Network Connections Folder.
More
Similar problem and similar fix for vmware:
http://aspoc.net/archives/2008/10/30/unidentified-network-issue-with-vmwares-virtual-nics-in-vista/
With a much nicer powershell script:
http://www.nivot.org/2008/09/05/VMWareVMNETAdaptersTriggeringPublicProfileForWindowsFirewall.aspx
And the virtualbox forums thread that pointed me in the right direction:
http://forums.virtualbox.org/viewtopic.php?f=6&t=17153#p73167

Thanks! Works every time!
— DigitalJer 2011-04-06 14:53 #
What Ihave to do if I found several subkeys for
VirtualBox Host-Only Ethernet Adapter (0012, 0013, 0017, 0021)?
Thanks
— Patrick Sallé 2011-10-20 08:34 #
@Patrick
Add a new DWORD value with a name of “*NdisDeviceType” and a value of “1”
— thijs 2011-10-20 19:56 #
Worked like a charm! Thanks!
— Michal 2011-11-09 13:32 #
Doesn’t work for me. My work colleague doesn’t have this problem. His works fine. Same laptop, brought on the same day. same OS (Win7)
— Adam 2011-12-22 16:22 #
Thanks man, that virtualbox network interface almost drove me insane.
— John 2012-01-05 22:35 #
Thanks a lot! That did the trick. Saved me a lot of time and trouble!
— fuggi 2012-02-02 14:40 #
Your repair works on Win8 as well.
— Kurt Mayol 2012-03-14 00:15 #
Sadly you have to do this after each update of VBox. But this for sure is not your fault!
— tiands 2012-05-15 16:07 #
Brilliant! Also works on Windows 8 Release Preview
— Deef 2012-06-03 08:34 #
I’ve just disabled the interface for years, but now I’m actually needing it, so I’m very happy to find your post. Thank you!
— David Brown 2012-08-21 22:28 #
What about this?
$nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]”{DCB00C01-570F-4A9B-8D69-199FDBA5723B}”))
$connections = $nlm.getnetworkconnections()
$connections |foreach { if ($_.getnetwork().getcategory() -eq 0) { $_.getnetwork().setcategory(1) }
}
Which is better solution ?
Use
$nlm.getnetworkconnections
or
modify NdisDeviceType in “HKLM:\SYSTEM\CurrentControlSet\Control\Class\*”
https://powertoe.wordpress.com/2009/12/28/enable-powershell-remoting-while-running-vmware-workstation-in-a-domain
thx
— kiquenet 2012-11-21 08:39 #
Great! Thanks!
— Dave 2014-10-05 21:45 #
Works!!! Guys, you go for DriverDesc: VirtualBox Host-Only Ethernet Adapter, not VirtualBox Host-Only Ethernet Adapter Miniport!!!
— Skane 2014-10-23 18:14 #