TransWikia.com

How can I eliminate the huge, cached MSI files in C:WindowsInstaller?

Server Fault Asked by Stein Åsmul on January 27, 2021

The size of the MSI cache folder (C:WindowsInstaller) 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:WINDOWSWinSxS (%SystemRoot%WinSxS)
  • C:System32DriverStore (%SystemRoot%System32DriverStore)

One Answer

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!
  1. 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: In their infinite wisdom 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:

Correct answer by Stein Åsmul on January 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP