How to get rid of vboxnet0 NIC from command line on Windows
<p>I have a virtual machine created by vagrant on Ubuntu 14.04 (VirtualBox 5.0.10). It has two NICs. NIC1 is NAT, NIC2 is hostonly. 
After importing that machine to VirtualBox 5.1.8 on Windows 10 I cannot run it as VBox complains that <strong>vboxnet0 (adapter 2)</strong> cannot be found.
If I show VM info in command line at this point (<code>VBoxManage showvminfo "myvm"</code>) NIC2 says: </p>

<blockquote>
  <p>Attachment: Host-only Interface 'vboxnet0'</p>
</blockquote>

<p>.</p>

<p>I found a workaround: disable NIC2 in VBox GUI and then enable it again. If I do this and run showvminfo again then NIC2 says: </p>

<blockquote>
  <p>Attachment: Host-only Interface 'VirtualBox Host-Only Ethernet
  Adapter'</p>
</blockquote>

<p>and machine will boot.</p>

<p>I'm looking for a way to automate this from command line. I tried to do this:</p>

<pre><code>VBoxManage modifyvm "myvm" --nic2 none
VBoxManage modifyvm "myvm" --nic2 hostonly
</code></pre>

<p>but then it sets back 'vboxnet0'.
How to force it to set proper Windows hostonly adapter from command line?</p>