When you install or update device drivers in Windows, older driver versions are still stored in the system. Thus, a user can roll back to the previous driver version if the new driver is unstable (a useful opportunity, as in the case of rolling back a Wi-Fi driver). However, Windows does not automatically clean and delete old driver versions, so as the time goes the size of disk space occupied by drivers becomes quite large. In this article, we’ll discuss how to remove old driver versions (duplicates) using the integrated system tools (without any third-part software).
Windows stores all driver files in its driver repository (Driver Store) located in %WINDIR%\System32\DriverStore\FileRepository. In my case on my home laptop running Windows 7 (installed almost 8 years ago), FileRepository folder occupies about 11 GB and contains over 5,000 files. It’s a good many! In particular, over 20 Nvidia driver versions are stored here.
- Never delete any files from DriverStore manually.
- Prior to clearing up the Driver Store, it is strongly recommended that you create a system restore point (
Checkpoint-Computer -Description "BeforeDriversDelete") or back up your system image.
- After cleaning the storage, you may have to download and install drivers manually if a new device is connected.
How to Find and Delete Old Driver Versions in Windows 7
Let’s see how to find and delete obsolete drivers in Windows 7. (In Windows 8 and Windows 10, easier ways to delete old drivers are used, these are described below).
Get the list of all third-party drivers available in the system and export them to a text file. To do it, run the following command in the command prompt with the administrator privileges:
dism /online /get-drivers /format:table > c:\tmp\drivers.txt
Import this text file into Excel, and delete all odd data in a way that only the table containing the list of drivers in the repository is left. The table should contain the number of the driver in the system (oemXXX.inf), the name of the original INF file, device class, manufacturer, installation date and driver version.
Sort this table by column B (containing the name of the original INF file) and column F (driver installation date). Among the drivers with the same name mark for removal all driver versions except the last one. In my case, you can see that the most part of old drivers are refer to the NVIDIA video adapter.
To delete a driver, you can use pnputil command:
pnputil.exe -d oemxxx.inf
pnputil -f -d oemxxx.inf
To make it more convenient, we will create in the empty column the commands to remove each driver using the formula:
=CONCATENATE("pnputil.exe -d ";A21)
Copy and run these commands in the command prompt or a BAT file.
pnputil.exe –d oem9.inf
Microsoft PnP Utility
Driver package deleted successfully
Thus, I have deleted about 40 old driver versions and freed about 8 GB of space (mostly due to removing of NVIDIA drivers).
How to Delete Old Drivers in Windows 10/8 Using Disk Cleanup
In Windows 10 / 8.1, there is a more convenient tool to delete earlier driver versions — familiar Disk Cleanup tool (cleanmgr.exe) that also allows to delete deprecated updates.
- Run Disk Cleanup: Win+R -> cleanmgr
- Select the system disk
- Click Clean up system files
- Check Device driver packages in the list Note. In my system the size of stored driver copies is 0. In real systems it is likely to be different
- Click OK
Cleanmgr will delete all old unused driver versions. However, you should understand that the Roll back driver button in Driver Properties tab of Device Manage will become inactive.