Emergency server help: get in touch

WinSxS Cleanup on Windows Server 2022 and 2025: Free Disk Space Safely

Measure the WinSxS component store with DISM AnalyzeComponentStore, clean it safely with StartComponentCleanup, and understand what /ResetBase takes away.

Published 7 min read

Short answer: Measure first with Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore, then run Dism.exe /Online /Cleanup-Image /StartComponentCleanup to remove superseded update components. Add /ResetBase only if you accept that installed updates can no longer be uninstalled. Never delete files from C:\Windows\WinSxS by hand: Microsoft warns it can leave the server unable to boot or update.

Applies to Windows Server 2016, 2019, 2022 and 2025

Commands checked against the official documentation (linked below) on 7 October 2026; not yet run on our lab servers.

Why WinSxS looks so big (and usually is not)

C:\Windows\WinSxS is the component store. It holds every Windows component, the files Windows needs to install roles and features, and older versions of components replaced by cumulative updates so those updates can be removed. Most of the files you see under C:\Windows\System32 are hard links to files in WinSxS: one copy on disk, two names.

File Explorer and most disk-usage tools do not understand hard links, so they count those shared files twice and report a WinSxS size that is far larger than the real overhead. Before you clean anything, get the real number from DISM.

Step 1: Measure the component store with AnalyzeComponentStore

Open an elevated Command Prompt or PowerShell window and run:

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

The report has these lines. The ones that matter for cleanup are in bold:

FieldWhat it means
Windows Explorer Reported Size of Component StoreThe inflated size Explorer shows, counting hard links twice.
Actual Size of Component StoreThe real size on disk, including files shared with Windows.
Shared with WindowsFiles hard-linked into System32 and elsewhere. Not reclaimable; Windows needs them.
Backups and Disabled FeaturesSuperseded components and payloads for features you have not enabled. Part of the overhead.
Cache and Temporary DataInternal servicing cache. Part of the overhead.
Date of Last CleanupWhen the last component cleanup finished.
Number of Reclaimable PackagesSuperseded packages that a cleanup can remove.
Component Store Cleanup RecommendedYes or No. If No, cleanup will free little or nothing.

The space you can realistically get back is roughly “Backups and Disabled Features” plus “Cache and Temporary Data”. Note the numbers so you can compare after cleanup.

Step 2: Run StartComponentCleanup

Windows already has a scheduled task, \Microsoft\Windows\Servicing\StartComponentCleanup, that runs when the machine is idle. It waits at least 30 days after an update before removing the previous component versions and stops after one hour, so on busy servers it often never finishes.

Running DISM yourself removes superseded components immediately, with no 30-day grace period and no one-hour limit:

Dism.exe /Online /Cleanup-Image /StartComponentCleanup

Plan for this:

  • Run it in a maintenance window. It is CPU and disk heavy and can take from a few minutes to well over an hour on a server that has not been cleaned for months.
  • Do not run it while Windows Update, WSUS or another servicing operation is installing updates. Finish pending updates and reboot first.
  • Make sure you have a current backup or snapshot of the server, as you would before any servicing change.

If you would rather let Windows do it on its own schedule, you can trigger the built-in task instead:

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

Step 3 (optional): /ResetBase and what it costs you

With /ResetBase, every update installed at that moment becomes permanent. You cannot uninstall any of them afterwards. Only use it on a server that has run fine on the current updates for a while, and never as the first thing you try.

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

/ResetBase removes all superseded versions of every component, so it frees more space than a normal cleanup. Microsoft states that it does not block uninstalling future updates, only the ones already installed. That trade-off makes sense for a golden image you are about to capture, or a server that is short of space and stable on its current patch level. It is a poor choice on a server where you might need to roll back last month’s cumulative update.

You may also see /SPSuperseded in older guides. It removes backup files from a service pack install, which is not relevant to Windows Server 2022 or 2025.

Disk Cleanup and Storage Sense on Windows Server

Disk Cleanup (cleanmgr)

Microsoft documents Disk Cleanup as available by default on Windows Server 2016, 2019, 2022 and 2025. On a server with the Desktop Experience, open it as administrator and choose Clean up system files; the Windows Update Cleanup option removes superseded update components, the same job as StartComponentCleanup. Other options (temporary files, Recycle Bin, old setup files) free space outside WinSxS.

To run it from the command line with the same choices each time, save a profile once and reuse it:

cleanmgr /sageset:1
cleanmgr /sagerun:1

On Server Core, use DISM. It needs no GUI and gives you the before-and-after numbers.

Storage Sense

Storage Sense lives under Settings > System > Storage. Microsoft’s configuration documentation targets Windows 10 and 11, while its troubleshooting article says it is also built into Windows Server editions. Either way, Storage Sense cleans temporary files, the Recycle Bin, the root of the Downloads folder and cloud-synced content on the system drive. It does not reduce the component store, so do not count on it for WinSxS.

Why you must not delete WinSxS files by hand

Microsoft is direct about this: deleting files from WinSxS, or the whole folder, may damage the system so badly that it does not boot and cannot be updated. The reasons:

  • Files in System32 are hard links to WinSxS. Deleting the “copy” in WinSxS deletes the only real file.
  • Windows Update, Add Roles and Features and SFC/DISM repair all read from the component store. Missing components make updates fail with errors such as 0x800f081f or 0x80073712.
  • Taking ownership of WinSxS to delete files also breaks the permissions that servicing relies on.

The same goes for “WinSxS cleaner” utilities that delete folders directly. Use DISM, the scheduled task or Disk Cleanup, which all go through the servicing stack.

Check that it worked

  1. Run Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore again. “Date of Last Cleanup” should show today, “Number of Reclaimable Packages” should be 0 or close to it, and “Component Store Cleanup Recommended” should be No.
  2. Compare “Backups and Disabled Features” and “Actual Size of Component Store” with the numbers you noted before.
  3. Check free space on C: with Get-Volume -DriveLetter C.
  4. Confirm servicing still works: Dism.exe /Online /Cleanup-Image /ScanHealth should report no corruption, and the next Windows Update scan should succeed.

Common problems

  • Cleanup freed almost nothing: “Component Store Cleanup Recommended” was probably No. Most of the store is “Shared with Windows”, which no tool can remove. Look elsewhere for space: C:\Windows\SoftwareDistribution\Download (stop the Windows Update service first), old IIS or application logs, crash dumps, user profiles on RDS hosts.
  • DISM reports pending operations: an update is waiting for a reboot. Restart the server, then run the cleanup again.
  • DISM stuck at a percentage for a long time: progress is not linear. Give it time and watch disk activity in Resource Monitor before deciding it has hung.
  • Component store corruption reported: repair first with Dism.exe /Online /Cleanup-Image /RestoreHealth, using a matching install source if Windows Update is not reachable (see our DISM RestoreHealth offline source guide).
  • C: still full after cleanup: follow a structured approach such as our disk full runbook to find the real space users.

Official documentation: Clean up the WinSxS folder · Determine the actual size of WinSxS · Using Disk Cleanup on Windows Server · cleanmgr command

Related: DISM RestoreHealth Offline Source: Windows 11 Repair · Windows Update Error 0x800f0922, 0x80070002, 0x80073712: Fixes · Disk full on a production server: recovery runbook · WSUS Windows Server 2025: Reliable Install and Configuration · Server Inventory Report

Frequently asked questions

Can I delete the WinSxS folder on Windows Server?

No. Microsoft warns that deleting WinSxS files or the folder can stop the server from booting and make it impossible to update. Use DISM StartComponentCleanup or Disk Cleanup instead.

What does /ResetBase do?

It removes all superseded versions of every component. After it runs, updates that are already installed can no longer be uninstalled, although future updates still can be.

How much space will StartComponentCleanup free?

Roughly the “Backups and Disabled Features” and “Cache and Temporary Data” figures from AnalyzeComponentStore, minus anything still needed. If cleanup is not recommended, expect little gain.

Is it safe to run DISM StartComponentCleanup on a production server?

It is a supported servicing operation, but run it in a maintenance window, after pending updates and reboots are finished, with a current backup.

Does Storage Sense clean WinSxS?

No. Storage Sense removes temporary files, Recycle Bin contents and similar user data. Use DISM or the Windows Update Cleanup option in Disk Cleanup for the component store.

Maintenance record

This guide changes servers, data or security settings, so we re-check it against current versions on a fixed schedule. Take a backup or snapshot before you start.

Maintained by
srvScripts editorial team
Supported versions
Windows Server 2016, 2019, 2022 and 2025
Last full review
Next review

Free website test

Is your website set up right?

Check SSL, security headers, redirects, robots.txt, sitemap, llms.txt and security.txt in one test. It takes about 30 seconds.