Published by


Brink's Avatar
Administrator

Posts: 25,240

Show Printable Version 


How to Clean Up Component Store (WinSxS folder) in Windows 10

information   Information
One commonly asked question is can I delete the WinSxS folder to regain some disk space? The short answer is no. However, there are ways to reduce the size of the WinSxS folder.

The component store (WinSxS folder) contains all the components that make-up Windows to allow you operate your system. These components are kept to rollback any problematic change or to repair a file that becomes corrupted.

The WinSxS folder is located in the Windows folder, for example "C:\Windows\WinSxS". Itís the location for Windows Component Store files. The Windows Component Store is used to support the functions needed for the customization and updating of Windows. Here are some examples of how the Windows Component Store files are used:
  • Using Windows Update to install new component versions. This keeps systems secure and up-to-date.
  • Enabling or disabling Windows features.
  • Adding roles or features using Server Manager.
  • Moving systems between different Windows Editions.
  • System recovery from corruption or boot failures
  • Uninstalling problematic updates
  • Running programs using side-by-side assemblies

Windows 10 and Windows Server 2016 automatically reduces the size of the WinSxS by using methods similar to the ones described in this tutorial, however these methods also include internal processes, such as uninstalling and deleting packages with components that have been replaced by other components with newer versions. Previous versions of some components are kept on the system for a period of time, allowing you to rollback if necessary. After a period of time, these components are removed from the installation.

In Windows 10 and Windows Server 2016, you have a number of ways to start the cleanup of the component store, which use a combination of package deletion and component compression to clean up the WinSxS folder.

For more information about the Windows Component Store (WinSxS folder), see:

This tutorial will show you different ways on how to clean up the Component Store (WinSxS folder) to reduce its size in Windows 10.

You must be signed in as an administrator to clean up the component store (WinSxS folder).

Note   Note
If you like, you can analyze the Component Store (WinSxS folder) first to see if it is recommended to clean up or not.


CONTENTS:
  • Option One: Clean Up Component Store (WinSxS folder) using StartComponentCleanup Task
  • Option Two: Clean Up Component Store (WinSxS folder) using /StartComponentCleanup with Dism Command
  • Option Three: Clean Up Component Store (WinSxS folder) using /StartComponentCleanup and /ResetBase with Dism Command
  • Option Four: Clean Up Component Store (WinSxS folder) using /SPSuperseded with Dism Command





Clean Up Component Store (WinSxS folder) in Windows 10 OPTION ONE Clean Up Component Store (WinSxS folder) in Windows 10
Clean Up Component Store (WinSxS folder) using StartComponentCleanup Task

Note   Note
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.

If you choose to run this task, the task will have a 1 hour timeout and may not completely clean up all files.



The StartComponentCleanup task can also be started from an elevated command prompt:

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


1. Press the Win+R keys to open Run, type taskschd.msc into Run, and click/tap on OK to open Task Scheduler.

2. Navigate to and open the folder below in the left pane of Task Scheduler. (see screenshot below step 3)

Task Scheduler Library\Microsoft\Windows\Servicing


3. In the middle pane of Servicing, select the StartComponentCleanup task, and click/tap on Run under Selected Item in the right pane. (see screenshot below)

Click image for larger version. 

Name:	StartComponentCleanup_task-1.png 
Views:	133 
Size:	85.1 KB 
ID:	131513

4. The StartComponentCleanup task will now be running until finished. This may take a while to finish running. (see screenshot below)

Click image for larger version. 

Name:	StartComponentCleanup_task-2.png 
Views:	191 
Size:	84.6 KB 
ID:	131514





Clean Up Component Store (WinSxS folder) in Windows 10 OPTION TWO Clean Up Component Store (WinSxS folder) in Windows 10
Clean Up Component Store (WinSxS folder) using /StartComponentCleanup with Dism Command

Note   Note
Using the /StartComponentCleanup parameter of Dism.exe on a running version of Windows 10 gives you similar results to running the StartComponentCleanup task in Task Scheduler, except previous versions of updated components will be immediately deleted (without a 30 day grace period) and you will not have a 1-hour timeout limitation.


1. Open an elevated command prompt.

2. Enter the command below into the elevated command prompt, and press Enter. (see screenshot below)

Dism.exe /online /Cleanup-Image /StartComponentCleanup


3. When finished, you can close the elevated command prompt if you like. This may take a while to finish running.

Name:  StartComponentCleanup_command.png
Views: 8284
Size:  13.9 KB





Clean Up Component Store (WinSxS folder) in Windows 10 OPTION THREE Clean Up Component Store (WinSxS folder) in Windows 10
Clean Up Component Store (WinSxS folder) using /StartComponentCleanup and /ResetBase with Dism Command

Note   Note
Using the /ResetBase switch with the /StartComponentCleanup parameter of DISM.exe on a running version of Windows 10 removes all superseded versions of every component in the component store.

warning   Warning
All existing service packs and updates cannot be uninstalled after this command is completed. This will not block the uninstallation of future service packs or updates.


1. Open an elevated command prompt.

2. Enter the command below into the elevated command prompt, and press Enter. (see screenshot below)

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


3. When finished, you can close the elevated command prompt if you like. This may take a while to finish running.

Name:  StartComponentCleanup_ResetBase_command.png
Views: 8281
Size:  14.3 KB





Clean Up Component Store (WinSxS folder) in Windows 10 OPTION FOUR Clean Up Component Store (WinSxS folder) in Windows 10
Clean Up Component Store (WinSxS folder) using /SPSuperseded with Dism Command

Note   Note
To reduce the amount of space used by a Service Pack, use the /SPSuperseded parameter of Dism.exe on a running version of Windows 10 to remove any backup components needed for uninstallation of the service pack. A service pack is a collection of cumulative updates for a particular release of Windows.

warning   Warning
The service pack cannot be uninstalled after this command is completed.


1. Open an elevated command prompt.

2. Enter the command below into the elevated command prompt, and press Enter. (see screenshot below)

Dism.exe /online /Cleanup-Image /SPSuperseded


3. When finished, you can close the elevated command prompt if you like. This may take a while to finish running.

Name:  SPSuperseded_command.png
Views: 8280
Size:  15.0 KB


That's it,
Shawn