Programmatically uninstall a device in windows device manager

Is it possible to programmatically uninstall a device in windows and perform a 'scan for hardware changes' programmatically? Is there any VB script that can be used for the same? Or is there any windows API that can be called to achieve the same?

Upvotes: 3

Views: 6068

Answers (1)

Ruddy
Ruddy

Reputation: 1754

To force the 'scan for hardware changes' checkout "How To Force Reenumeration of a Device Tree From an Application" the sample there shows how to force the entire tree to be re-enumerated.

As to removing a driver checkout DiUninstallDevice.

Upvotes: 4

Related Questions