You are currently viewing Windows 10 – Clean up System32\DriverStore\FileRepository and free up a lot of space

Windows 10 – Clean up System32\DriverStore\FileRepository and free up a lot of space

It’s been a year or two since you last reinstalled Windows. The problem of missing space on the system partition returns like the boomerang . Do you know it? This time I decided to check what is the reason. What I found caused me a slight shock and disbelief. In today’s post, I collected all the actions that should be taken to remove unused NVIDIA drivers from the system and free up space on drive C. In my case it was as more than 17GB of garbage! Let’s clean it!

I don’t know why, but NVIDIA doesn’t seem to care about disk space on users’ computers and still hasn’t fixed the problem of storing old driver installers in one of the folders of the Windows operating system. Is it normal for drivers to weight several GB after two years of use? After all, current SSDs – although cheaper – still cost a lot. I also don’t believe that NVIDIA is not aware of this problem.

Don’t like reading?

Deleting temporary folders with driver installers

The least risky thing that you can do to free up some space on your C drive is to delete unnecessary NVIDIA drivers installers from the following folders. In some cases, this will recover up to 1GB of disk space. This action can be performed normally from the Windows File Explorer or by running the following commands in the console.

rd /s /q "C:\NVidia"
rd /s /q "C:\Program Files\NVIDIA Corporation\Installer2"

Deleting drivers from the C:\Windows\System32\DriverStore\FileRepository folder

In my case, this folder was over 17GB?! Unfortunately, you can’t just delete its content because it contains the driver files used by Windows.

The first thing to try is to run the NVIDIA driver installer and select “Perform a clean install” in the custom installation options. The installer should remove the redundant drivers from the Windows repository.

If this method fails, you can use the pnputil tool. Below is the result of calling the pnputil /e command which lists installed drivers.

Published name :            oem21.inf
Driver package provider :   Microsoft
Class :                     Drukarki
Driver date and version :   06/21/2006 10.0.18362.1
Signer name :               Microsoft Windows

Published name :            oem9.inf
Driver package provider :   Oracle Corporation
Class :                     Karty sieciowe
Driver date and version :   01/25/2019 6.0.4.0
Signer name :               Oracle Corporation

Published name :            oem18.inf
Driver package provider :   Western Digital Technologies
Class :                     WD Drive Management devices
Driver date and version :   11/30/2017 1.2.0.0
Signer name :               Microsoft Windows Hardware Compatibility Publisher

Looking at the names, you can see that they all have the oem<number>.inf. To remove a specific driver, run the pnputils / d oem<number>.inf command as Administrator. If the driver is in use or the name is incorrect, the driver will not be removed. Below is an example of trying to remove the printer driver.

pnputil /d OEM21.INF

All in one – ready to run script

We can therefore use this fact and write a loop trying to remove all unused drivers in the range from 1 to 500. The following script run with administrator privileges will perform all the actions described in the article.

Create the cleanup_drivers.cmd file(in any location) with the following content:

@echo off
rd /s /q "C:\NVidia"
rd /s /q "C:\Program Files\NVIDIA Corporation\Installer2"

for /L %%I in (1,1,500) do (
 echo Trying delete driver: OEM%%I.INF
 pnputil /d OEM%%I.INF
)

Then run it with administrator privileges. Warning! The script can also remove other drivers not currently used (e.g. for a rarely connected printer or other device). If you want to be sure that you only remove graphics card drivers, then I suggest you do pnputil /E and then delete the drivers one by one using the pnputil /D command. You use the following script only at your own risk.

That’s all what I’ve prepared for you in this tutorial, if I helped you, please consider sharing this post to help me gain a wider audience.
Thanks and I hope to see you in my next tutorial.