How to remove phantom/ghost devices

*What is phantom device?

Hidden, inactive deives, ghost devices. When a device is physically removed from a machine, the driver becomes a phantom and is no longer visible in Device Manager. Normally this is desirable, but can be a problem if you wish to remove the device driver.

*How to identify and remove phantom devices in device manager (manually)?

do the following:
1.  From the command prompt on the problem media server, run:C:\>set devmgr_show_nonpresent_devices=1C:\>start devmgmt.msc
2.  Then, select View from the drop down and select to Show Hidden Devices.At this point, any ghost tape devices will be seen with lighter, transparent icon and can be removed.  This is done by right-clicking the ghost tape device and selecting "Uninstall".

 

*How to do this by programming?

devcon command works!

Find *  FindAll *  Remove "@hwid"