Is it safe to delete from C:\Windows\Installer?
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.)
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.
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.
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.
Make a junction! [1][2]
- Start a command prompt as administrator. [3]
-
Take ownership of installer directory and all its files:
takeown /f "C:\Windows\Installer" takeown /f "C:\Windows\Installer\*"
- Move
C:\Windows\Installer
to a new spacious drive, let's sayE:
. 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 beE:\Win7-Junctions\Installer
. Cut-paste from Windows Explorer should be enough to move the installer folder. - Make sure that
C:\Windows\Installer
is really gone and that all files have been moved toE:\Win7-Junctions\Installer
. -
Create the junction:
mklink /j "C:\Windows\Installer" "E:\Win7-Junctions\Installer"
The syntax is:
mklink /j [destination] [source]
Verify that the junction works by creating a small text file in
E:\Win7-Junctions\Installer
and seeing it materializing inC:\Windows\Installer
as well.- 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.