Driver Hunter - Programatically Uninstall Drivers in Windows


Going down the rabbit hole of trying to make sense out of the Setup-API on MSDN in order to figure out how to safely and fully remove drivers from a Windows machine has definitely caused a few extra gray hairs on my head today

Fortunately the fruit of a day's labor is Driver Hunter - a working solution that can query devices installed and successfully remove both the devices, and associated drivers from the system.

I've open sourced the application in case anyone is interested in the code, or cares to add to it or improve it in any way.
Driver Hunter project on GitHub

As it stands the application will initially query all devices, in all classes that are installed on the machine (not only the ones present). And subsequently filter out only the devices in the: USB, MEDIA, and Image clases.

After the enumeration, it will build a UI with a list of all devices discovered in a list. Clicking on a device will display information about installed drivers compatible with the device in a list on the right. Two buttons become available: Remove Device and Uninstall Drivers.

Driver Hunter User Interface

Note that in order to be able to successfully remove devices and drivers the application must be run as Administrator, and on 64-bit systems the 64-bit version must be executed. The 32-bit version will run on 64-bit machines under WOW64 but will fail to remove any devices or drivers. This is restriction of the WOW64 system

is the founder of Donaq, a software development consulting company with a focus on mobility. You can find Mike on Google+ and on LinkedIn.
Design copyright (c) Miky Dinescu