3 Ways to Safely Delete Unused MSI and MSP Files from Windows Installer Folder

There is now a 4th option! Patch Cleaner.
I created this 100% free software. It cleans the windows installer directory with one easy click.
If you don’t trust it, you can use the move action to move the orphaned files to another folder until you are satisfied it hasn’t done anything wrong.
Windows Installer Directory

When applications are installed and updated on the Windows Operating System a hidden directory "c:\Windows\Installer" is used to store the installer (.msi) files and the patch (.msp) files.

Generally these files are important as during updating, patching or uninstalling software it will use the .msi/.msp files. If you blanketly delete all the files in this folder, you will find yourself needing to rebuild windows.

Over time as your computer is patched and patched again, these installer files become outdated and orphaned. They are no longer required, but they can take up many gigabytes of data.

PatchCleaner

PatchCleaner identifies these redundant/orphaned files and allows you to either:
  1. (Recommended) Move them to another location. If you want to play it safe, just move them to another location, and you can always copy them back.
  2. Delete them.
How it works
HomeDev has had many queries about how PatchCleaner works and if it can be trusted to do the right thing.

Its pretty simple. The windows operating system holds a list of current installers and patches, that can be accessed via WMI calls, (Windows Management Instrumentation ).

PatchCleaner obtains this list of the known msi/msp files and compares that against all the msi/msp files that are found in the "c:\Windows\Installer" directory. Anything that is in the folder but not on the windows provided list is considered an orphaned file and is tagged to be moved or deleted.

HomeDev cannot warrant that PatchCleaner will not find a false positive and delete a required patch which is why we have added the filter feature to filter and recommend using the move function, that way you can always copy the patches back if required. Please see the Known Issues List at the bottom of the page

CLI - Command Line Interface
As of verison 1.3, patch cleaner implements a CLI, (Command Line Interface).

The application can now be run from the command line with the following switches:

/d - This will execute with the delete action.
/m - This will execute the move action with the default location as stored in your local app configuration.
/m [FilePath] - This will execute the move action, where [FilePath] is the location you wish to move the files to.

The process will write the output to the console window and also logs the messages to the windows event log.

Malware

After 18,000+ downloads, I have had some feedback that a few users are having problems where PatchCleaner is being detected as Malware.

Firstly let me reassure you that there is no Malware contained within PatchCleaner.

To stop PatchCleaner from being detected as malware would require purchase of an SSL certificate and digitally signing the software.

Given this is 100% free software I cannot justify the expense in doing this, so I do apologise for any extra clicks you may have to do to install PatchCleaner but I don't think this will change any time soon.

Known IssuesAdobe Reader patcches are detected incorrectly as orphaned files. As of verson 1.4, PatchCleaner now has an exclusion filter that allows you to filter out the Adobe Acrobat patch files so they can be excluded from the set of orphaned files. The exclusion filters are configurable

Requirements
Windows 7 / 8 or 10, x64 or x86 (not compatible with windows XP)
.Net framework 4.5.2
Also, runs on Windows Server, Confirmed on Server 2008 R2 x64 and Server 2012 R2 64

Download
There is a new sourceforge project where the portable version can be downloaded.
Support
Installation Issues

Some people have encountered some installaton challenges when attempting to install. If you hit problems then I suggest you try the following.

The installer that you download from the website is a self extracting 7z archive created as per my blog post (http://ntsblog.homedev.com.au/index.php/2015/05/14/self-extracting-archive-runs-setup-exe-7zip-sfx-switch/).

So you can actually open the .exe file with 7Zip and extract the files (setup.exe and PatchCleaner.msi).

I would then try running the PatchCleaner.msi file directly.

3 Ways to Safely Delete Unused MSI and MSP Files from Windows Installer Folder

Solid State Drives (SSD) are fast becoming the norm for many users to place their Windows install onto, but because prices for the larger drives are still quite expensive, many users have smaller capacity drives. If you have a smaller SSD or your Windows boot drive or partition isn’t that large, you need to watch every Gigabyte that goes onto it or its space can fill up pretty quickly. Using tools such as TreeSize or SpaceSniffer to find which folders are taking up precious space on your drive might show that the Installer folder located in Windows is one of them.

If you check the Installer folder in Windows (C:\Windows\Installer), you will most likely find a lot of MSI and MSP files in there taking up a few gigabytes of your hard drive, with some people even reporting 10GB+. Do note that the Windows Installer folder has a hidden and system attribute. To see the folder, you will need to select “Show hidden files, folders and drives” and uncheck “Hide protected operating system files” from the Folder Options in Control Panel. Viewing the Property details of those MSI and MSP files in the Windows Installer folder could show that they are connected to software currently installed on your computer and others most probably from software you have uninstalled which you don’t use anymore. The good news is some of the MSI and MSP files are orphaned and no longer needed which you can safely delete. The big problem is identifying them because just deleting any MSI or MSP file you choose is a bad idea as they might be required for updating, patching or uninstalling existing applications.

Below is an Office 2003 MSP file from an old installation.


Use An Old Microsoft Utility

One of the old tools that could do this was MsiZap which was developed by Microsoft. The tool is available with The Windows Installer Clean Up Utility (Msicuu) which is basically a frontend for some of MsiZap’s commands. Microsoft discontinued both MsiZap and Msicuu some time ago after saying they were causing too many issues, but many users still use MsiZap with some success. Download the Windows Installer Clean Up Utility and then extract it with 7-Zip to use the MsiZapU.exe.

Open a Command Prompt, type MsiZapU.exe G and press enter. The G command tells the program to remove any orphaned cached Windows Installer data files. While testing we got an error on both Windows 7 and XP similar to the following although it did say it had cleared some orphaned files out.


MsiZapInfo: Performing operations for user S-1-5-21-598190838-2299067166-971484642-1000
Removing orphaned cached files.
Error enumerating Products key for S-1-5-21-598190838-2299067166-971484642-1000 user. Error: 6.
FAILED to clear all data.

MsiZap is definitely a tool to be used with caution because Microsoft usually don’t pull utilities unless there’s a valid reason to do so.
Windows Installer Unused Files Cleanup Tool

The Windows Installer UnUsed Files Cleanup Tool (WICleanup) by KZTechs is able to scan for orphaned MSI and MSP files in the \Windows\Installer folder and offers you an option to delete them from the comfort of a graphical user interface. For scripts and command line usage, WICleanup also includes a command line version in the archive (WICleanupC.exe).


All you need to do is extract the downloaded ZIP file, run the WICleanupUI.exe and click the Scan button. All the entries that show in the window are orphaned files and manually check the boxes for what you want to delete. Although it has no option to automatically select all files for deletion, you can use the Shift key to multi-select, i.e; click the first file, hold Shift and click the last file, then click one of the selected tick boxes. It would have been useful if this tool offered an option to backup the unused files instead of deleting them in case of any potential problems. Note the the website is in Chinese.

Download WICleanup
Deleting The Unused MSI Entries Manually

Before you simply go into the C:\Windows\Installer folder and start deleting files on your own to free up some space, there is a way to determine which files are orphaned and should be safe to delete. Because the patch files still registered will have a corresponding entry in the registry, those that are missing aren’t necessary anymore.

Heath Stewart over at blogs.msdn.com wrote a small vbscript a few years back that checks the system for registered patch files, and lists those that are. This way you will be shown the files that you SHOULD NOT delete from \Windows\Installer as they are the ones still in use, those not in the list are safe to remove

Download WiMsps VBScript

Do note that this download isn’t the original vbscript found on the website as that has an annoying OK popup on every registered entry it comes across which can be very annoying because there’s often loads of them. We’ve made a minor modification to output the registered entries to a text file instead.


Don’t forget, these are the currently registered patch files and the ones to not touch. We would recommend you don’t manually delete files from the Installer folder anyway without some experience, and moving them to another folder just in case a problem occurs is more preferable.