HOWTO compress Windows OEM Drivers Repository


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.

Create a new ‘temporary’ 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 compact.exe, and set ‘Add arguments (optional):’ to

/c /s /i “%systemroot%\system32\driverstore\filerepository”

Confirm and save the task.

Now select it and run manually. This first run will set the folder as ‘compressed’ and it will be inherited by all future new folders.
Keep clicking on Refresh, to see when it is completed.

Now its time to compress all the existing files.

Edit our task, go to Actions page and edit the action.

Update ‘Add arguments (optional):’ to

/c /s /i “%systemroot%\system32\driverstore\filerepository\*”

Save everything, and run it again.

Now the processing time will be longer depending on how many Gb it has to process.
Keep clicking on ‘Refresh’, to see when it is completed.

When completed, we can delete our temporary task.

Mission 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 /u /i "%systemroot%\system32\drivers\*"
compact /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.