Clean Up Component Store (WinSxS folder) in Windows 10  

Page 1 of 9 123 ... LastLast
    Clean Up Component Store (WinSxS folder) in Windows 10

    Clean Up Component Store (WinSxS folder) in Windows 10

    How to Clean Up Component Store (WinSxS folder) in Windows 10
    Published by Category: Performance & Maintenance
    12 Aug 2022
    Designer Media Ltd

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


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

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


    For a Windows 11 version of this tutorial, see:

    Analyze and Clean Up Component Store (WinSxS folder) in Windows 11



    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






    OPTION ONE

    Clean Up Component Store (WinSxS folder) using StartComponentCleanup Task


    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)

    Clean Up Component Store (WinSxS folder) in Windows 10-startcomponentcleanup_task-1.png

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

    Clean Up Component Store (WinSxS folder) in Windows 10-startcomponentcleanup_task-2.png






    OPTION TWO

    Clean Up Component Store (WinSxS folder) using /StartComponentCleanup with Dism Command


    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.

    Clean Up Component Store (WinSxS folder) in Windows 10-startcomponentcleanup_command.png






    OPTION THREE

    Clean Up Component Store (WinSxS folder) using /StartComponentCleanup and /ResetBase with Dism Command


    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.

    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.

    Clean Up Component Store (WinSxS folder) in Windows 10-startcomponentcleanup_resetbase_command.png






    OPTION FOUR

    Clean Up Component Store (WinSxS folder) using /SPSuperseded with Dism Command


    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.

    This option will most likely never be needed for Windows 10 since service packs are no longer used for Windows 10.


    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.

    Clean Up Component Store (WinSxS folder) in Windows 10-spsuperseded_command.png


    That's it,
    Shawn Brink






  1. Posts : 1,471
    Win10 Home x64 - 1809
       #1

    FWIW ...
    Seems like Win10 1809 is doing a better job of cleaning up after itself, when the Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase is run. I don't think it actually does the /ResetBase, unless you do the registry hack, but don't quote me on that ... I haven't done the registry hack to find out :)

    Note: I still check the C:\windows\winsxs\temp\ (Inflight,PendingDeletes,PendingRenames) folders to see if any folders/files are still there. Seems there's always a few files left in PendingDeletes that can't be deleted, until you boot to Command Prompt and delete them manually.
      My Computers


  2. Posts : 208
    Win 10
       #2

    I did option 1 and it ran almost 2hrs.
      My Computer


  3. Posts : 155
    Windows 10 Pro
       #3

    have a question regarding this.

    Does the DISM ResetBase Functionality is enabled by default in Windows 10 or disabled? How to check that?And AFAIK, DISM ResetBase Functionality uses for cleanup the installed updates & components like CU & SSU etc from the OS WinSxS folder. Or that has anything to offer more apart from this? Can someone enlighten me in this matter?
      My Computer


  4. Posts : 56,804
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #4

    SM03 said:
    have a question regarding this.

    Does the DISM ResetBase Functionality is enabled by default in Windows 10 or disabled? How to check that?And AFAIK, DISM ResetBase Functionality uses for cleanup the installed updates & components like CU & SSU etc from the OS WinSxS folder. Or that has anything to offer more apart from this? Can someone enlighten me in this matter?
    Neither, actually. The DISM commands are not any scheduled part of Windows Cleanup. Old Windows Update files, yes, periodically, they get compressed and/or deleted thru the Scheduled Maintenance. WinSxS and the components are a manual cleanup, as far as I know. A new update (such as 1903 upgrade) will wipe them all out and write a new set for the OS. But Cumulatives, like Patch Tuesday, add updated ones and new ones. ResetBase prevents rolling back updates, just be aware.

    In addition, the DISM cleanup commands are best run in Safe Mode to avoid open/locked components preventing completion.

    This command can be run to determine if the Component Store needs a cleanup.

    Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

    Then, the best series of commands, run in Safe Mode, is:

    fsutil resource setautoreset true c:\&fsutil usn deletejournal /d /n c: (cleans up NTFS file system)

    then:

    Dism.exe /online /Cleanup-Image /StartComponentCleanup

    Dism.exe /Online /Cleanup-Image /RestoreHealth

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

    When all done, reboot back to Normal Mode.

    NOTE: Optionally, a SFC /SCANNOW run first before anything ensures the component store system files are correct.
      My Computers


  5. Posts : 155
    Windows 10 Pro
       #5

    f14tomcat said:
    Neither, actually. The DISM commands are not any scheduled part of Windows Cleanup. Old Windows Update files, yes, periodically, they get compressed and/or deleted thru the Scheduled Maintenance. WinSxS and the components are a manual cleanup, as far as I know. A new update (such as 1903 upgrade) will wipe them all out and write a new set for the OS. But Cumulatives, like Patch Tuesday, add updated ones and new ones. ResetBase prevents rolling back updates, just be aware.

    In addition, the DISM cleanup commands are best run in Safe Mode to avoid open/locked components preventing completion.

    This command can be run to determine if the Component Store needs a cleanup.

    Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

    Then, the best series of commands, run in Safe Mode, is:

    fsutil resource setautoreset true c:\&fsutil usn deletejournal /d /n c: (cleans up NTFS file system)

    then:

    Dism.exe /online /Cleanup-Image /StartComponentCleanup

    Dism.exe /Online /Cleanup-Image /RestoreHealth

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

    When all done, reboot back to Normal Mode.

    NOTE: Optionally, a SFC /SCANNOW run first before anything ensures the component store system files are correct.
    Well, I don't use LTSC, but here I am talking about Win10 v1903 x64 retail/consumer based ISO, is it wise to turn on that feature or just leave that as it is (disabled) to avoid any issue?
      My Computer


  6. Posts : 56,804
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #6

    SM03 said:
    Well, I don't use LTSC, but here I am talking about Win10 v1903 x64 retail/consumer based ISO, is it wise to turn on that feature or just leave that as it is (disabled) to avoid any issue?
    Are we talking 2 different things here? I'm not on LTSC, either. No reason. This is personal Pro 10 . I'm not clear on what "feature" you're referring to. Sorry.
      My Computers


  7. Posts : 155
    Windows 10 Pro
       #7

    f14tomcat said:
    Are we talking 2 different things here? I'm not on LTSC, either. No reason. This is personal Pro 10 . I'm not clear on what "feature" you're referring to. Sorry.
    Sorry, NVM.
      My Computer


  8. Posts : 56,804
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #8

    SM03 said:
    Sorry, NVM.
    Sorry if I'm thick-headed, but what is NVM?
      My Computers


  9. Posts : 26,406
    Windows 11 Pro 22631.3296
       #9

    f14tomcat said:
    Sorry if I'm thick-headed, but what is NVM?
    Nevermind TC
      My Computer


 

Tutorial Categories

Clean Up Component Store (WinSxS folder) in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:28.
Find Us




Windows 10 Forums