Uninstalling device - command line style?

pingaan

New Member
Hi,

I have been having an issue the past few months, but I have never really come up with a decent idea on how to work around it.
It concerns a USB-hub that I'm using that my copy of Windows, for some reason, reinstalls every time I reboot the computer. I'm pretty sure that there must be some conflict with that hub itself, but I'm in no position to replace it. To me it's a very special item!
In order to get the hub to work again I have to uninstall the device and reboot, so I figured I could batch it and have the batch file run each time I reboot. Where as the batch would contain commands removing/uninstalling the device, in order for it to make a "fresh" install each time I boot up the computer.

I have been browsing the web a bit but all I can find is how to remove drivers and not really the hardware itself.

So to conclude my question here... Is there a way to uninstall hardware via cmd, in the same that if I press uninstall on the dropdown menu inside "device manager"?

Best regards!
 

Neemobeer

Windows Forum Team
Staff member
You can use the built-in utility pnputil

  1. First open device manager and locate the device
  2. Right click the device and go to properties
  3. Under the details tab select the properties drop down and select Inf Name (in the format oem##.inf)
  4. pnputil /delete-driver oem##.info /uninstall /force
  5. Then pnputil /add-driver C:\path\to\driver.inf /install
 

pingaan

New Member
Thanks for the almost instant answer!

I follow you up till point 4 but what happens on 5? Do I need to add drivers which are already built in?
 

Neemobeer

Windows Forum Team
Staff member
You'll need to know where the inf file is. AN INF file is a setup information file. if you run the command pnputil /enum-drviers and look for your oem##.inf there will be a field called original name. You can then search for the location of that file and supply as the path to pnputil /add-driver
 
Top