10

The size of the MSI cache folder (C:\Windows\Installer) has grown substantially, and is now taking up way too much disk space on my (domain) computers. Can this folder be eliminated or shrunk?

Same question goes for:

  • C:\WINDOWS\WinSxS (%SystemRoot%\WinSxS)
  • C:\System32\DriverStore (%SystemRoot%\System32\DriverStore)
3

2 Answers 2

15
+50

Summary

The directory %SystemRoot%\Installer and its contents must never be meddled with. An unserviceable system almost always results. Same goes for WinSxS, Driver Store & GAC.

Using administrative installations (please skim linked answer) is a general purpose measure to reduce the size of the %SystemRoot%\Installer folder for future deployments. Usually used in corporate deployment. Essentially a file extraction of installation source that you put on a network share.

  • Administrative installs can drastically reduce the size of the local cache folder
  • Must be done per package, and you need a stable, always on network share (or a stable local path / drive).
  • See bottom section: "Administrative Installation".

General Disk Space Tips:

The real issue is disc space - SSD drives are still too small for comfort. Below are some suggested procedures you can use to regain space in a safer way.


Original & Long Answer

Below are the essential / most effective options summarized from this original and messy answer: Trifles & Tricks: Obvious ways to free up disc space on your system drive (long).

Microsoft's piece on space reclamation: Free up drive space in Windows 10


Express: Urgent 5-Minute Space Reclamation

  1. Storage: Insert a USB drive (low-profile if you want it connected permanently) or SD-card. Move the content of your Downloads and Largest Media folders on there. Use USB 3.X port! (blue / red / teal).
  2. Mongers Sweep: In Windows Explorer, select "Users folder" (C:\Users), press F3 and select "Size: Gigantic" (or very large). Move them away if found - with caution:
    • Typically ISOs, Virtuals, Movie files, etc...
    • Careful with: Outlook PST files! Database files!
    • Leave alone: all *.SYS files!
    • Avoid source code folders and virtual disks (move whole folder only)!
    • In short: Move only files you know are safe to move!
  3. Zap Re-downloadable Files? (many huge files can easily be re-acquired)
    • iTunes?, ISOs?, Installers (in Downloads)
    • Zap clouded files? (local cache)

Many further options below. Just the 5-minute emergency procedure I use myself (trivial options).

And obviously empty the recycle bin :-). Also quick to uninstall large, unused software packages.

And check root of C:\ for virtuals and similar uses. Most large files should be in profile hierarchy though.


Reclaim Disc Space - The Pragmatic Options

Recommended real-world quick-options for disc space reclamation:

Low-profile USB & SD Card

  • General: Removables & Disc Space Visualization.

    • Add a low-profile USB drive and / or SD-Card to your laptop for "permanent", extra storage to move large files to. Generally not high-speed, use accordingly. Note! I find low-profile USB drives may run a bit hot under load. Not for heavy, continuous use IMHO.
    • Find Space Hogs: https://en.wikipedia.org/wiki/WinDirStat. Visualization tool for disc space consumption. May run slowly on non-SSD disks. Shows what eats your disc.
  • Option 0: Clouding. Obviously. OneDrive, Dropbox, Google Drive, etc...

  • Option 2: Microsoft's Disk Cleanup Tool. Purge Windows Update files & more.

    • Windows Key + Tap R, type cleanmgr.exe and press Enter.
    • Select system drive and press OK
    • Now click Clean up System Files then select system drive and press OK.
  • UPDATE Oct.2018: Microsoft has added the "Downloads" folder as a cleanup option! This is pure lunacy, DO NOT ENABLE! It deletes the whole downloads folder without question.

And one more update:

Note: In recent Windows 10 version the cleanmgr.exe tool has been deprecated and replaced with the new Windows 10 settings app. Type: ms-settings:storagesense in the start dialog to open the new GUI. The start dialog opens with: Windows Key + Tap R.

  • Option 7: Clean out Downloads folder (all users).
    • Move files to USB / SD / other partition.
    • Change default Downloads location: Right Click Folder => Properties => Location.
    • One shared location for all users - if applicable?
  • Option 18: Compression (selective folders?). In Folder Properties. May be ultra slow for old disks.
  • Option 19: Uninstall unnecessary software. Run appwiz.cpl from Windows Key + Tap R

High risk option: Delete outdated and obsolete recovery partition(s) and create a usable partition in its place to keep data on.

Runners-Up: Option 4: Administrative Installation is presented below. Maybe also check Option 3: (CCleaner) (not without risk). And a final mention: you can turn off system restore as well (particularly for virtuals). Not listed in linked answer (max lenght).


Scavenging / Putting WinSxS on a Diet

The WinSxS folder - Win32 side-by-side assembly store is full of hard links (several shortcuts to the same "physical" file) and often obsolete versions that can never be used (superseded by policy and updates). You can run "Scavenging" - garbage collection for side-by-side Win32 assemblies.

"Find actual size" command that is available since Win 8.1 (from elevated command prompt):

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore  

This goes beyond all the hard links in there and finds the actual size of the WinSxS folder - and whether it should be cleaned up.

Run "Scavenging" (from elevated command prompt):

 Dism.exe /online /Cleanup-Image /StartComponentCleanup

Microsoft's Disk Cleanup Tool: cleanmgr.exe seems to kick off "scavenging" sometimes. And there is a scheduled task (Win8 up) - kicking off cleanup. Slightly different from running the command. 30 days grace period before purging, and some timeout issues (ends after 1 hour, regardless).


Superuser: Why does the /winsxs folder grow so large, and can it be made smaller?


Administrative Installation

You can't safely delete these files, they are there to facilitate uninstall, modify and repair operations for the installed product. You can, however, greatly reduce the size of the cached MSI files by running an administrative installation (essentially a file extraction) of the MSI before installing it. Follow link above for description - you should put these extracted files on a network share.

The cached MSI files used to be small because they were stripped of their internal CAB files. However, starting with Windows 7 (MSI version 5) the MSI files are now cached full size to avoid breaking the file signature that affects the UAC prompt on setup launch (a known Vista problem). This may cause a tremendous increase in disk space consumption (several gigabytes for some systems).

Running admin install will extract the files from the CAB files embedded in the MSI, adjust the media layout in the Media table in the new MSI so that running it will use the extracted, external source files instead of internal CABs. The new and smaller MSI file used for installation is then cached on the system. This can save several gigabytes of disk space, depending on what installers you use, how many you have to install, how big they are, etc... Keep in mind that you must deal with the UAC prompt issue described above when using admin images since the extracted MSI is (normally) no longer signed, but from a reputable source (your own extraction).

The extracted files and the associated MSI file should be put on a network installation point along with all other installers to ensure files are available for repair operations. This is how most large corporations deal with installation anyway. Then there is no need for embedded CAB files in the cached MSI at all. SCCM and other deployment systems may also have other ways to ensure files are available for repair operations.

Some further links:

7
  • 2
    "You can't delete these files" -> You shouldn't delete these files, because doing so break stuff.
    – Chris S
    Nov 5, 2014 at 16:31
  • 1
    Yes, deleting the files will cause the package to be uninstallable unless you have access to and can run the original installation media. Several other, serious problems will also surface with regards to patching, upgrades, repair, self-repair, etc... These are core OS resource files and must be left alone. Nov 5, 2014 at 16:33
  • At work, we've had a few Win10 PCs that have started to fill up their C: drive due to the remains of repeatedly failing Windows updates piling up in the C:\Windows\Installer folder. I've fixed these by using the Media Creation Tool to create Win10 media on a USB stick, which I then used to do an 'upgrade' install of Win10 over top of the existing Win10 install. Works perfectly, unless you don't have enough space on C: to do an 'upgrade' install, in which case you need to do some other cleanup first.
    – 3D1T0R
    Sep 25, 2018 at 21:03
  • Would be interesting to know if the cleanmgr.exe (Microsoft Disk Cleanup Tool) would be able to clean that? It might not do so until after 30 days or something like that? I am not sure. The internal details of this tool remains mysterious, but it does a lot of things "under the hood". Seemingly different actions from time to time as well. Sep 25, 2018 at 21:06
  • cleanmgr.exe is always the first thing I do before I start digging into the rest of 'my space recovery tool kit'. In my experience, it's never done anything to help with cleaning up C:\Windows\Installer.
    – 3D1T0R
    Sep 26, 2018 at 0:28
-1

Not really a short term fix - more a long term strategy - but it sounds like network drive shares for documents (to let them roam and persist) along with semi-regular rebuilds of the machines are needed.

More practical - imaging a drive via Linux with dd is a quick and easy way to clone a disk onto a larger disk. See if you can get some larger hard drives for the worst offenders, clone their disk and expand it (https://superuser.com/questions/1050894/using-dd-to-clone-a-hdd-to-an-ssd), and they should be up and running again in no time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .