When installing or updating device drivers in Windows, old versions of drivers remain. Over time, the accumulation of these old drivers can take up a significant amount of system space. Below, I will introduce how to safely delete these old driver files.
Author: Yu Mufa
○ Knowledge: Understanding Old Drivers
Open the “C:\Windows\System32\DriverStore\FileRepository” folder, and you will see many folders with names like “nvdmwu.inf_amd64_dbcf8f3256gjkl” and “nvdmwu.inf_amd64_3dc6555tg6725k”. These folders are primarily used for rolling back to previous drivers when new drivers are unstable. The folders contain the old drivers for the local graphics card (Figure 1).
(Figure 1)
○ 1. Disk Cleanup Method
If we have upgraded the hardware drivers and have not encountered any issues after some time, most of the old drivers are no longer valuable. However, in the window shown in Figure 1, by default, users do not have permission to delete the folders (Figure 2).
(Figure 2)
To delete these unnecessary drivers, you can use the built-in “Disk Cleanup” tool. Type “Disk Cleanup” in the taskbar search box, then click “Run as administrator”. After launching the disk management component, select the system drive, then check “Device driver packages” in the list of files to delete (this is the old driver files), and finally click “OK” to delete the unnecessary driver files (Figure 3).
(Figure 3)
○ 2. Using PowerShell Commands
The above method can remove most of the unnecessary old drivers. For any remaining old drivers, you can use PowerShell commands to delete them.
1. Export All Currently Used Drivers
Start Windows PowerShell as an administrator, then enter the command “Get-WmiObject Win32_PnPSignedDriver| select DeviceName, DeviceClass, Manufacturer, DriverVersion, DriverDate, InfName| Export-CSV e:\1.csv” and press Enter. This will export all drivers on the machine to the “e:\1.csv” file.
2. Filter Out Old Drivers
Open the exported file in Excel, select the first row, and click “Data → Filter” to add filter buttons. Then select column A, and click “Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values → Fill with Red”. This will mark all drivers with the same name in column A as red. Then click “Filter → Filter by Color → Red” to keep only the drivers with the same name. Continue to select columns D and E (driver version and date), and apply the same conditional formatting to see that the drivers in column D that are not marked in red are those with the same name but different versions (Figure 4).
(Figure 4)
3. Uninstall Unnecessary Drivers
Locate cell G106 and enter the formula “=CONCATENATE(“pnputil.exe -d “, F106)” (note that there is a half-width space after “-d”), then drag down to fill to cell G110, and copy the data area G106:G110 (Figure 5).
(Figure 5)
Note:
Cell G111 contains the latest driver, which must be retained (you can distinguish it by version number and driver date). If there are more drivers to process, be careful to delete the command corresponding to the latest driver cell.
Then start the command prompt as an administrator and paste the above command to delete all the old drivers found (Figure 6). The same operation applies to find all old driver files corresponding to column G and uninstall them.
(Figure 6)
○ 3. Use Third-Party Software to Remove Unused Drivers
If you find manual operations too complicated, you can download DevManView from “https://www.nirsoft.net/utils/device_manager_view.html” to view and delete old drivers.
DevManView displays a lot of driver information by default, and you can set the displayed information as needed. After launching the software, click “View → Column” and check the information you need to display, such as driver name, driver date, and version (Figure 7).
(Figure 7)
Click “OK” to return to the main interface of the program, then look for drivers with the same name but inconsistent versions in the driver list. For example, in my computer, the Bluetooth driver has a new version of 10.0.19041.1320, and the driver date is 2021.8.25. You can select the old version of the driver with the same name in the list, right-click, and choose “Uninstall Selected Devices” to uninstall it (Figure 8).CF
(Figure 8)
Original article published in the 22nd issue of Computer Enthusiast on December 27, 2022
END
Stay tuned for more exciting content…