Cleanup WinSxS folder safely

PowerShell Aug 25, 2026

Ever wondered how to clean up the Windows WinSxS folder that is occupying tons of storage and thought how to clean it up safely without deleting and breaking the Windows?

Well I have found out how, and I am going to share that with you.

Open PowerShell, as an administrator and we will go through 3 simple steps.

Check actual size of the folder

We are going to analyze what the actual size vs the apparent size of the folder because it might be different on what we can actually safely clean than what it is we can recover.

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

Cleaning the data

This step removes superseded updates and cleans up the component store.

Dism.exe /Online /Cleanup-Image /StartComponentCleanup

Remove update backups (optional)

This step is optional but you might be able to squeeze a bit more storage out of it because it removes all superseded update backups.

Note: You will not be able to uninstall any currently installed updates after running this.

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

Advanced Disk Cleanup Tool

If you still need a bit more space, you can run the Disk Cleanup tool in advanced mode and try to get more space out by cleaning other items.

Still from PowerShell, as an administrator, you should launch the advanced Disk Cleanup tool.

Launch the advanced Disk Cleanup tool and you select all applicable boxes in the form. After you click OK, it won't automatically run the cleanup.

Cleanmgr.exe /sageset:1 

To run the cleanup, use the command below.

Cleanmgr.exe /sagerun:1

Tags