Clean FileRepository Folder in DriverStore (Windows 10)

Maciej
2 min readJan 4, 2019

--

Cleaning Up DriverStore\FileRepository

Basically you can delete all of the folder contents in Windows 10 — but this might be unsecure, and you might face with errors, crashes etc.

Important. As a precaution, we strongly recommend creating a restore point first before deleting any of the files.

Windows 10 has a built-in disk cleanup tool that can also remove old unused drivers.

  1. Run the Disk Cleanup Wizard by pressing the Win + R keys and entering the command cleanmgr.exe;
  2. In the Disk Cleanup for (C:) window, click the Cleanup System Files button;
  3. Select the Device driver packages option and click OK to start up the drivers clean up.

This method of cleaning the FileRepository folder is extremely inefficient. It is unlikely that you will be able to reduce the size of the folder by more than 100 MB.

In case you want to clean up DriverStore folder more deeply, please follow the steps below 😃

  1. Export the list of drivers in the table form to a text file using the command:
    dism /online /get-drivers /format:table > c:\drivers.txt

2. Now you can delete all unnecessary drivers with the help of command pnputil.exe /d oemNN.inf (NN — is a number of drivers file package from drivers.txt, as example oem02.inf). In case the driver is in use, you will see an error while trying delete it.

3. If there are a lot of drivers in the system, you can use the following script for automatic drivers removal. Create a text file cleanup.bat with the following code and run it as an administrator. This script will sequentially loop all inf files with an index from 1 to 600 and delete the corresponding driver files. If the driver is used or doesn’t exist, it will be skipped:

--

--

Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.