Showing posts with label device. Show all posts
Showing posts with label device. Show all posts

Wednesday, May 4, 2011

Windows Hidden/Not Connected Device Removal Script And Devcon Musings

I recently needed to create a quick script that uninstalls any devices that have since been disconnected from the system (or fail to be seen). Normally these devices can only be found if you open a command prompt and enter the following (then show hidden devices):

set devmgr_show_nonpresent_devices=1
start devmgmt.msc

The problem arose when I had a large number of touchy USB data aquisition devices that required this to be performed regularly, which becomes very tedious. This is where the devcon utility comes in handy. Although there are a few small problems; the devcon utility has issues removing hidden devices. A lot of people claim this is because it just in fact doesn't do it, as there is apparenly a flag in the program that prevents you from doing it out of the box and modifying the source is the only way to go (I have looked through the source, and I could find no such thing that would cause this behaviour). This is flat out incorrect, you can indeed remove hidden devices with devcon out of the box (provided you have the correct version for your Windows installation, more on this later).