148

I've been looking on an XP machine what is using all that diskspace, and it turns out C:\Windows\Installer is high up there on the list of directories that use the most diskspace.

It seems to contain a cache of msi and msp files.

Is it safe to delete those? To save diskspace, I've been deleting the "$KB...$" directories for ages without any problems. I want my Windows Updates in my system, why you would want to uninstall them is something that I have never understood. (Except when you're on an update revision board professionally or something of that order.)

Run5k
  • 16,463
  • 24
  • 53
  • 67

9 Answers9

96

No, it's not. Windows Installer uses that to cache installation files for anything installed on the machine using Windows Installer. At a minimum, you could lose the ability to add or remove programs, at the worst, you may lose the ability to run some programs.

Since Windows Update can also deploy Windows Installer patches, you could also prevent your machine from receiving Windows and Office updates.

jasonh
  • 3,107
75

You most likely need the content of the installer folder when you try to uninstall programs (e.g. microsoft office will complain some random named .msi/.mcp files when you try to remove it)

But if disk space is concern to you, compress the installer folder through NTFS! I do so in my ASUS Eeepc901 netbook, since it has a horrible 4G primary partition only.

Right click the folder "Installer"->properties->advanced->check "Compress contents to save disk space."->"OK"->"OK" again.

You'll be surprised by the space it saved.

deddebme
  • 3,814
11

As others have said, there are definite contraindications for removing files from that directory structure. I would also recommend against it.

However, if you are determined to proceed anyways, you can more properly do so using the Windows Installer CleanUp Utility. This will clean things up better than simply deleting files. This tool is, however, generally used for removing installation files that have become corrupt thus preventing you from uninstalling something the normal way.

The Windows Installer CleanUp Utility actually uses the MSIZAP.EXE command-line utility to perform the work.

Gregyski
  • 359
9

Make a junction! [1][2]

  1. Start a command prompt as administrator. [3]
  2. Take ownership of installer directory and all its files:

    takeown /f "C:\Windows\Installer"
    takeown /f "C:\Windows\Installer\*"
    
  3. Move C:\Windows\Installer to a new spacious drive, let's say E:. For convenience, it's better to create a subfolder to gather all the future junctions in one place, e.g. E:\Win7-Junctions, so the new path will be E:\Win7-Junctions\Installer. Cut-paste from Windows Explorer should be enough to move the installer folder.
  4. Make sure that C:\Windows\Installer is really gone and that all files have been moved to E:\Win7-Junctions\Installer.
  5. Create the junction:

    mklink /j "C:\Windows\Installer" "E:\Win7-Junctions\Installer"
    

    The syntax is:

    mklink /j [destination] [source]
    
  6. Verify that the junction works by creating a small text file in E:\Win7-Junctions\Installer and seeing it materializing in C:\Windows\Installer as well.

  7. Done. Check within "Add or remove programs" that installers are still working (Office is a good candidate to start with).

A word of warn, as stated in this Microsoft answer:

It is never suggested to move the operating system core components and files to a drive other than the operating system drive. Because they will cause instabilities in the operating system files.

Run this commands on your risk, Microsoft cannot guarantee any problems resulting from this can be solved.

Given that having constantly 0 bytes of disk space was indeed causing instabilities to the OS (and its users) and that Microsoft couldn't guarantee that any ordinary problem they created could be solved at all in a reasonable way, I went on with this procedure and found no significant drawbacks until now.

Avio
  • 957
7

No, it's not safe to delete the whole dir.

But there are ways to remove the unused .msp files by running WICleanup.

Kevin Panko
  • 7,466
Terry Shi
  • 290
4

As other answers state, it is not safe to delete the Windows Installer folder completely. But here are some popular practical solutions to safely move or shrink it:

How can I free up drive space from the Windows installer folder without killing Windows?

Personally I used PatchCleaner that helped me to knowingly reduce Windows\Installer size from 23 to 3 Gb by moving orphaned packages (mostly M$ Office 2016 updates).

Vadzim
  • 1,342
3

If you delete this folder, you will experience issues later when you attempt to repair, uninstall, upgrade, reinstall, etc.

The way MSI installers work is they run themselves whenever a patch must be rolledback, something uninstalled, etc.

Future Windows Updates may need the contents of this folder.

MSI installers are the devil :() Don't toy with them.

Kevin Panko
  • 7,466
AaronLS
  • 2,303
2

When disk space is running out on a system disk, may it be on a server or a client, there are certain things to clean out. One of them being the %SYSTEMDRIVE%\Windows\Installer folder. You cannot under any circumstances delete files from this folder manually as this not only may but most likely will break software that is installed using MSI files, or Windows Installer files.

The %SYSTEMDRIVE%\Windows\Installer folder is a cache for installation files and patches (MSP files) and removing those will cause you to not being able to repair or uninstall applications, and in some cases not removing patches or applying new patches to software. In the event when you actually did delete this cache you can rebuild the files you need manually by extracting the files from original installation media, from patch packages etc but this is a time consuming and not that easy task to accomplish.

Andreas Stenhall, MVP Windows Expert ITPRO Ref.: http://www.theexperienceblog.com/2009/05/16/how-to-clean-out-windowsinstaller-folder-correctly/

You may try to make some SAFE cleaup with this MS Fix It utility: Diagnose and fix program installing and uninstalling problems automatically

climenole
  • 3,516
  • 1
  • 22
  • 30
-3

You an always use a program like CCleaner to clean up the system.

I just reclaimed over a gig of disk space!

g t
  • 125
JFV
  • 1,025