winsxs folder cleanup

22 Feb

Depends on the OS version.  With Windows 10, it should be self-maintaining.  For Windows 8.1, you can use DISM:

DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase

For Windows 7, the /ResetBase option isn’t available.

The nuances of /ResetBase vs. no /ResetBase are kind of important:  With /StartComponentCleanup, older versions of updated components are removed from the winsxs folder, but the latest version and the original version are still present.  With /ResetBase, you are saying to get rid of the original version as well.

Of course once you do either of these commands, you make it much more difficult to uninstall updates.

Other than these DISM commands, there’s no supported way to clean up winsxs.

First :
Cleanmgr /sageset:1 & @pause & CleanMgr /sagerun:1
Tick all ticks in the first cleaner popup and hit OK
Then press a key at the “Press any key to continue” prompt
The cleaner will then clean stuff you normally cannot see in CleanMgr
Then :
Dism /Online /Cleanup-Image /AnalyzeComponentStore
Dism /Online /Cleanup-Image /StartComponentCleanup
Dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase
Dism /Online /Cleanup-Image /SPSuperseded
Then optionally:
Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
And if issues are found:
: Dism /Online /Cleanup-Image /RestoreHealth