Remove Ghosted NIC from a Windows VM

By | 2014-08-20

After performing a V2V, P2V or a clone operation in which the VHD/VHDX file is copied to a new VM, a new NIC is installed in the virtual machine.  This is evidenced by the need to once again set the IP configuration of the NIC.

Failing to remove this NIC can cause problems with some monitoring software, not to mention you’ll get a popup error (if you are configuring the NIC with the same IP address) like this:

​”The IP address x.x.x.x you have entered for this network adapter is already assigned to another adapter.”

Removing the ghost NIC is a simple process, but requires you to set an environment variable prior to running device manager.  The entire process is described below.

First, fire up an elevated command prompt by pressing the Windows key on your keyboard, typing the letters CMD.  The command prompt will float to the top of the search list on the right.  Right click the command prompt entry, and select Run as administrator.

Next, type the following in the command prompt:

set devmgr_show_nonpresent_devices=1
start devmgmt.msc

You’ll be presented with the trusty device manager.  If you expand the Network Adapters branch now, you won’t see your ghosted NIC.  You need to enable the viewing of hidden devices first.  Click on View on the top line menu bar, then select Show hidden devices.

Note that if you are running Active Directory, you can push out the following registry modification to bypass this “devmode” part of the procedure.

System Key: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\
Environment]
Value Name: DEVMGR_SHOW_NONPRESENT_DEVICES
Data Type: REG_SZ (String Value)
Value Data: (1 = show all hidden devices)

Now, if you expand the Network Adapters branch in the tree, you’ll see the extra network adapter.  Pay attention to the icons on the left of the names.  The grayed-out one is the one that is a ghost.  Right-click the NIC and select Uninstall.

Click OK on the confirmation dialog, and your ghosted NIC will be removed.

Take note: This problem is not specific to HyperV.  It happens in VMware ESX as well.

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.