1
I need to automate the uninstall and reinstall a driver on Windows 7. The process to manually do this is:
- Start
- Right Click Computer > Manage
- Device Manager > Network Adapters
- Right Click Intel(R) Dual band Wireless-AC 7260 > Uninstall
- DO NOT DELETE, leave the delete option unchecked, just hit OK for it to be uninstalled.
- Right click Network Adapters > Scan for Hardware Changes
I need to regularly perform these steps, so I'd like to find a way of automating them.
I have found these two command line tools which seem relevant, but neither of them seem to do exactly what I want.
wmic
# Outputs a list. I can parse this to find the index of the device.
wmic nic get name, index
wmic path win32_networkadapter where index=<from above> call disable
wmic path win32_networkadapter where index=<from above> call enable
Those commands have output that suggests they did whatever they're supposed to do, but it doesn't have the same effect as uninstalling and reinstalling the driver.
pnputil
pnputil -e
This outputs a list. It doesn't seem to include the same human readable name used in Device Manager (which wmic above did), but I see this device listed which I think is it:
Published name : oem186.inf
Driver package provider : Intel
Class : Network adapters
Driver date and version : 08/01/2013 16.1.3.1
Signer name : Microsoft Windows Hardware Compatibility Publisher
I have a few problems with this, though. When I go into the GUI Device Manager and Right Click Driver > Properties > Driver Tab > Driver Details, it lists off the following files:
C:\windows\system32\DRIVERS\Netwfw02.dat
C:\windows\system32\DRIVERS\NETwsw02.sys
C:\windows\system32\drivers\vwifibus.sys
None of which are the name that pnputil
called it. Further, Details Tab > Included Infs calls it netvwifibus.inf
- also not something pnputil
called it.
Another issue with pnputil
is it doesn't seem to have an uninstall command. All it has is pnputil -d
, which it says is for deleting the package (what is a package? How does that differ from a driver? Are they they same?) My manual instructions are explicitly not to delete the driver, only to uninstall it. I'm hesitant to even try using this delete option since I see no easy way of undoing it if it ends up being the wrong thing.
summary
wmic
can disable and enable drivers, but I want to uninstall and reinstall them.
pnputil
can add and delete packages. The word delete scares me as it seems to offer no way of easily backing up or rolling back, so I haven't tried it. Also, what is a package anyways? What is its relationship with a driver... is it the same thing?
1Please explain why you need to uninstall and reinstall drivers regularly. This screams out as a case where you are seeking a solution for the wrong problem. – ChrisInEdmonton – 2015-07-23T14:39:24.733
My laptop regularly loses the ability to see wifi networks. It seems to have something to do with connecting it to Ethernet then disconnecting it. Restarting the computer doesn't fix it. Reinstalling the driver does. The reason I follow that procedure is because it's what the help desk at work told me to do whenever I can't see wifi networks, and the procedure works. I have checked for updates to the driver and none are available. I also can't roll back the driver since no prior version is available. – ArtOfWarfare – 2015-07-23T14:43:00.670
@ChrisInEdmonton - I suppose if you have a way of fixing the actual problem that would be helpful, but I'm still baffled as to how I would uninstall and reinstall a driver via the command line - surely that's a useful thing that other people would want to know how to do? – ArtOfWarfare – 2015-07-23T14:44:38.517
The very first thing you should try and do is install the latest driver from vendor site. here is the link https://downloadcenter.intel.com/product/75439/Intel-Dual-Band-Wireless-AC-7260
– pun – 2015-07-23T15:57:35.620@The_IT_Guy_You_Don't_Like - All of those results are about Bluetooth drivers - this is a wifi issue. Also, I tried updating the driver via the Windows service and it told me it was up to date. Finally, this is a company owned computer connecting to an internal VPN... I'd be concerned with the possibility that they've modified the drivers some how to specifically connect with our VPN. Which is why I'd like to use the automating the directions the help desk gives you to solve my problem. – ArtOfWarfare – 2015-07-23T17:03:15.793
@ArtOfWarfare, They are not bluetooth drivers.(it is bluetooth technology) Windows update may not always find the latest driver. Also, company helpdesk would always point you to install the drivers either from the company repository or the manufacturer site and very unlikely to ask you run wmic script to disable and re-enable device – pun – 2015-07-23T17:13:34.307
@The_IT_Guy_You_Don't_Like - Today I decided to bite the bullet and try that upgrade. I'm now running 18.12.1.2 instead of 16.1.3.1... only time will tell whether the weird issues of it randomly losing the ability to connect to wifi will continue or not. – ArtOfWarfare – 2015-08-21T14:06:05.030