WinSxS folder cleanup in Windows 10/8.1/8

Not many of you may know this, nor has this been blogged anywhere – yet; but Windows 8, Windows 8.1 and Windows 10 lets you safely cleanup the WinSxS folder. In fact you can even automate WinSxS folder cleanup using the Task Scheduler. The WinSxS folder, which stands for ‘Windows Side By Side’, is Windows native assembly cache with Libraries which are being by multiple applications being stored there. It is the location for storing Windows Component Store files.

Some common questions which Windows 7 and Windows Vista users asked were – Is there a way to cleanup the WinSxS folder so as to reduce its size? Can I delete the WinSxS folder? Or move WinSxS folder to another drive. The short answer, as we had seen in the earlier post was: No.

WinSxS folder cleanup

In Windows 8, Windows 8.1 and later, however, things have become easier. Windows 8 will automatically reduce the size of the WinSxS. These methods  include internal processes, such as uninstalling and deleting packages with components that have been replaced by other newer components. Previous versions are then kept for a period of time, after which they are automatically removed.

We saw that Windows 8.1 introduced a new command line option for DISM.exe, /AnalyzeComponentStore. Running this command, will analyze the WinSxS folder and tell you whether a Component Store Cleanup is recommended or not.

Windows 8 and Windows Server 2012 R2 offers a numbers of ways to cleanup of the WinSxS folder which includes the Windows Component Store. It may compress certain files or it may delete some packages. Let us see how you can cleanup WinSxS folder in these latest versions of the Windows operating system. There are 3 ways how you can do it.

1] Using StartComponentCleanup

The StartComponentCleanup task was created in Windows 8 to regularly clean up components automatically when the system is not in use. This task is set to run automatically when triggered by the operating system. When run automatically, the task will wait at least 30 days after an updated component has been installed before uninstalling the previous versions of the component.

To run it, open Task Scheduler and navigate to the following task:

Task Scheduler Library\Microsoft\Windows\Servicing\StartComponentCleanup

WinSxS folder cleanup

In the right pane, under Selected Items, you will see Run. Click on it to start the StartComponentCleanup task.

This will start a process called TiWorker.exe or Windows Modules Installer Worker. You will not see any confirmation dialog box that the process has been started, but you will be able to see it in the Task Manager – and feel a lot of hot air coming out of your laptops vent! By default, in Windows 8, if this tasks runs for more than 1 hour, it will terminate automatically. To end this process, you can click on End. You will in this case, see Windows asking you for confirmation: Do you want to end all instances of this task. Click Yes.

end-task

You may run it manually or you may schedule it to run, say every month using the StartComponentCleanup command, to clean up and compress the components.. You may automate the process by setting up a Trigger for the task to run using the Task Scheduler.

winsxs-trigger

Alternatively, you can also run the StartComponentCleanup task using an elevated Command Prompt, using the following command:

schtasks.exe /Run /TN "\Microsoft\Windows\Servicing\StartComponentCleanup"

If you are successful, you will see a SUCCESS message returned.

cmd-winsxs

2] Using Deployment Image Servicing and Management

Using DISM you can configure and update Windows features, packages, drivers and so on. The /Cleanup-Image parameter of Dism.exe, will provide you with advanced options to reduce the size of the WinSxS folder, writes TechNet.

A) Using the /StartComponentCleanup parameter of Dism.exe on a running version of Windows 8.1 gives you similar results to running the StartComponentCleanup task in Task Scheduler.

Open an elevated command prompt, type the following and hit Enter:

Dism.exe /online /Cleanup-Image /StartComponentCleanup

B) If you use the /ResetBase switch with the /StartComponentCleanup parameter, you will be able to remove all superseded versions of every component in the component store.

From the elevated command prompt, type the following and hit Enter:

Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

C) If you want to reduce the amount of space used by a Service Pack, use the /SPSuperseded parameter of Dism.exe on a running version of Windows 8.1 to remove any backup components needed for uninstallation of the service pack.

From the elevated command prompt, type the following and hit Enter:

Dism.exe /online /Cleanup-Image /SPSuperseded

Do note that if you carry out this command, you will not be able uninstall existing service packs and updates.

3] Disk Cleanup Tool

Home users should stick to using the Disk Cleanup Tool. Open the Disk Cleanup Utility and click on the Clean System Files button. You will see the option for Windows Update Cleanup. Check this option. This will help reduce the size of the component store.

system-disk-cleanup

Do note that deleting files from the WinSxS folder or deleting the entire WinSxS folder may damage your system and make it un-bootable. You may not also be able to install, uninstall or update Windows components, so exercise utmost precautions. For regular Windows users, you may create a system restore point first and then try Method 1 or Method 3 mentioned above. Method 2 is for advanced users.

Windows 7 users too can now use the Windows Update Cleanup option in the Disk Cleanup tool.

Posted by on , in Category Windows with Tags
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP Awardee in Windows (2006-16) & a Windows Insider MVP. Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.