HOWTO compress Windows OEM Drivers Repository

updated 15/05/2018


The project of today is: Can I use NTFS compression to system drivers repository?

It seems the ideal target to be compressed since it’s rarely used and it can consume 1 or more Gb of your system partition.

The first problem is that we can’t use Windows File Explorer to compress it because we don’t have the correct access rights.

The second problem is that using the command line approach by an elevated ‘Command Prompt’ has the very same problem.

The main problem here is that the folder is fully accessible by SYSTEM account only.
We can try to get folder ownership and change access right, but I don’t like such aggressive approach into OS internals.

What we need is to run the two needed commands using SYSTEM account.

The Solution

To do the trick, we can use Windows Task Scheduler.

The first step is to create and save the following .cmd file:

compact.exe /c /s /i "%systemroot%\system32\driverstore\filerepository"
compact.exe /c /s /i "%systemroot%\system32\driverstore\filerepository\*"

For instance we can save it to: c:\tasks\compress_repo.cmd

The second step is to create a new task and:

Into General page, set SYSTEM into Security Options and set the correct OS version below.

Into Actions page, add a new item.

Set the Program/script to execute:


and set ‘Add arguments (optional):’ to:

/c “<full filename of my .cmd file>”  (in our example: "c:\tasks\compress_repo.cmd")


Confirm and save the task.

No trigger is needed since we will use it only manually.

We will start it now and after every event like Windows 10 Upgrades because it ‘reinstalls’ the whole OS, and it resets these folders to their previous uncompressed state.

Start it and wait for its completion (press Refresh button update the window).

Mission almost accomplished.

Fixing Minor Drawbacks

Looking here and there, I discovered that some of the of the files became suddenly blue into these 2 folders:


I found out that they are hardlinks to copies into OEM Drivers Repository.

Honestly, I don’t like it, and my solution is to periodically expand them (if any).

I wrote this .cmd file:

compact.exe /u /i "%systemroot%\system32\drivers\*"
compact.exe /u /i "%systemroot%\system32\*.dll"

Then I created a new task (similar to the previous one), that is using SYSTEM user account, to execute:


with the following arguments:

/c “<full filename of my .cmd file>”

Since it’s a light task, I trigger it once per week.