Windows 10 e la cartella %windir%Installer

Nei computer dotati di dischi con capacità non elevata come ad esempio i tablet che hanno dischi SSD veloci ma di dimensioni più ridotte può capitare che nella partizione di sistema lo spazio libero risulti troppo basso per consentire le normalità attività del sistema operativo come ad esempio l’installazione degli aggiornamenti.

Per capire quali cartelle occupano più spazio sul disco è possibile utilizzare un tool come TreeSize Free di cui al momenento è disponibile la versione 4.21 anche in modalità portable.

Molto spesso dopo un’analisi delle cartelle che occupano più spazio sul disco si nota che una di queste è la cartella %windir%Installer utilizzata dal servizio Windows Installer come cache per i pacchetti d’installazione come indicato nel post Can you safely delete files in the %windir%Installer directory? dove viene anche indicato che non è possibile eliminare il contenuto di tale directory:

“Can I safely remove the files in this directory? The answer is flatly: No. So let’s talk about why this is a bad idea.

 

First, it is not supported. If you remove files from this directory and have issues, you may need to reinstall the application to get back to a good state. Therefore, that would suck for both you and the engineer that needs to deliver that message.

 

Second is the overall idea that you really should not remove items in the Windows directory. We build and test our software based on the existence of specific files and directories. When those files and directories dont exist, bad things can and will happen. However, that is a generalization that usually upsets many people so let’s be more specific. This particular directories job is to act as a cache location for Windows installer based applications. It holds stripped down versions of the Windows installer data files. During application install, update of the application or application removal, this directory is used by the application to confirm the existence of previously installed items to determine the next steps the installer needs to take. The files are different from machine to machine, so if you expect to delete the files in the directory and then copy them over from another machine, that would be incorrect. Removing items from here could cause you to have application crashes, or worse, require the reinstallation and patching of the application.”

Analoghe indicazioni vengono fornite anche nella KB2667628 – Missing Windows Installer cache requires a computer rebuild:

“The Windows Installer Cache is used to store important files for applications that are installed by using Windows Installer. By default, this cache is located in the c:\windows\installer folder, and it should not be deleted. If the installer cache is compromised, you may not immediately see problems until you take an action such as uninstalling, repairing, or updating a product.

When a product is installed by using the Windows Installer, important files are stored in the Windows Installer cache that are required for uninstalling and updating applications. Missing files cannot be copied between computers because the files are unique.”

Per eseguire la pulizia del sistema e dei file che risiedono nella cartella %windir%Installer non più necessari è possibile utilizzare il tool nativo Clean Manager a riguardo si vedano:

Un altro tool nativo in grado di eseguire la pulizia della cache dei pacchetti d’installazione memorizzata nella cartella %windir%Installer è Msizap.exe che con l’opzione a riga di comando “g” permette di rimuovere i file d’installazione orfani, tale tool però non è più disponibile in Windows 7 e successivi dove per risolvere i problemi connessi alle installazioni avvenute in modo non coretto è disponibile la fix KB17588 – Fix problems that block programs from being installed or removed.

Un’alternativa, non supportata, è l’utility PatchCleaner, di cui al momento è disponibile la versione 1.4.2.0, che esegue la pulizia della cartella %windir%Installer spostando o rimuovendo i pacchetti d’installazione orfani, tale tool è anche disponibile in versione portable al seguente repository di SourceForce https://sourceforge.net/projects/patchcleaner/. Per maggiori informazioni sul tool PatchCleaner si vedano le FAQ.