Monday, January 17, 2011

Removing ghost NICs after P2V

Sometimes after a P2V conversion or after recreating a VM and re-attaching the original hard drive, the drivers for the old physical NIC are still present and the physical NIC is still considered by Windows as a device on the machine.

The problem with that is that the original NIC will be ‘hidden’ somewhere in the system configuration and you'll be unable to assign the IP address to the new NIC because it is still bound to the old NIC.

In this situation Windows will come up with its annoying popup error message:

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

If you look in the list of devices in Device Manager you will notice that your new NIC is now listed as “Microsoft Virtual Machine Bus Network Adapter #2” and that no other NICs are apparently present in your system. So where is NIC #1? Well, it's still there but it is hidden and as long as Windows remembers about it you will not be able to assign the new NIC its correct IP address.

To get rid of the old ghost NIC, follow this simple procedure:

1.Click Start > Programs > Accessories > Command Prompt.
2.Type the following command and press Enter:

set devmgr_show_nonpresent_devices=1

3.Type the following command, and press Enter:

start devmgmt.msc

Make sure you type devmgmt.msc in the same Command Prompt where you typed "set devmgr_show_nonpresent_devices=1". This is because the "Set" command is only effective in the environment of the Command Prompt you opened and its setting will be cleared when you close it.

4.Now in Device Manager click View > Show hidden devices.
5.Expand Network adapters. The old physical network cards are now visible and grayed out.
6.Right-click on these NICs and click Uninstall.

At this point you can assign the IP address to the new virtual NIC.

Just a last note: as a Windows Active Directory administrator, and for ease of management, I suggest to set this environment variable globally via Group Policy and to push it down to all your computers. To do so define a new GPO that will put in place the following registry key:

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

A reboot will be needed for the registry key to be applied. I am sure that doing this via GPO will save you a lot of time, because old hidden NICs are a common and recurring problem in Windows environments and being able to uninstall them without going through a too long procedure is a major improvement to me.


  1. Good advice, with clear steps on how to do this - it is a simple process but is easy to overlook.

  2. Thanks for commenting, Sam. Yes, it was not a difficult problem to solve. Nonetheless I have encountered this kind of issue too many times at my customers. That is way I have come to think that using a GPO is really the best thing you could do anytime you are P2Ving some servers.

  3. Hi guys.

    I've ran into this problem too and I'm very glad I've found this DEVMGR_SHOW_NONPRESENT_DEVICES variable info, it made my day!

    The problem is that the issue was recurrent on all of the 40 systems we've converted and when we got into the "device Manager" window realize that there were a lot of "ghost" devices and in some cases removing all of them took us about 20 minutes per system.

    So after a quick search Google sent me to this very useful link ( a script that a really nice guy shared to remove all of the ghost devices in one step, unfortunately it requires the devcon.exe program from Microsoft (which you can get from here: I went a little further and made a really small *iso file with the script and the Microsoft program needed, went for the iso choice because as you may have already noticed, the problem that led you here is that you can't enable IP comms with the same IP address that you've got before (in my case, to get an additional IP address from the network guys was an issue).

    Anyway I'm sharing the iso file with all of you and I hope it will help you. Feel free to share it and test it. Here you can find the *iso ( its about 144K).

    Best regards to all of you!

  4. felipunk,

    DUDE, pardon the California accent, thank you ever so much for sharing this Java Script with us! I have been looking for this for MONTHS, and had little success with deacon.exe. EVERYTHING I had Googled came back to the same tired response of DEVMGR_SHOW_NONPRESENT_DEVICES variable, but when converting/upgrading a few 100 machines, yea I will get right to that (insert sarcasm here)....

    Thank you!

    1. Hi Scottie,

      This might come "a little overdue" ;) but I'm glad the iso was useful for you.

      Best regards!

  5. Hi,
    Is this ISO .js working with Win server 2008 R2?
    I am P2Ving 3x servers, and i do not want to remove all non present devices one by one. One server has more than 30-50.. thank you

  6. This is blue gold! Thank you very much...worked perfectly with Windows Server 2012 R2.

  7. Thank you very much! works perfectly on Windows Server 2012


Related Posts Plugin for WordPress, Blogger...