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

Source: https://srvscripts.com/guides/winsxs-cleanup-windows-server/
Updated: 2026-10-07
Publisher: srvScripts (https://srvscripts.com/)

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

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:

| Field | What it means |
| --- | --- |
| Windows Explorer Reported Size of Component Store | The inflated size Explorer shows, counting hard links twice. |
| Actual Size of Component Store | The real size on disk, including files shared with Windows. |
| Shared with Windows | Files hard-linked into System32 and elsewhere. Not reclaimable; Windows needs them. |
| Backups and Disabled Features | Superseded components and payloads for features you have not enabled. Part of the overhead. |
| Cache and Temporary Data | Internal servicing cache. Part of the overhead. |
| Date of Last Cleanup | When the last component cleanup finished. |
| Number of Reclaimable Packages | Superseded packages that a cleanup can remove. |
| Component Store Cleanup Recommended | Yes 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

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

- Compare “Backups and Disabled Features” and “Actual Size of Component Store” with the numbers you noted before.

- Check free space on C: with `Get-Volume -DriveLetter C`.

- 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](/guides/dism-restorehealth-offline-source/)).

- **C: still full after cleanup**: follow a structured approach such as our [disk full runbook](/guides/runbook-disk-full/) to find the real space users.

**Official documentation:** [Clean up the WinSxS folder](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder?view=windows-11) · [Determine the actual size of WinSxS](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/determine-the-actual-size-of-the-winsxs-folder?view=windows-11) · [Using Disk Cleanup on Windows Server](https://learn.microsoft.com/en-us/windows-server/storage/file-server/disk-cleanup) · [cleanmgr command](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cleanmgr)

**Related:** [DISM RestoreHealth Offline Source: Windows 11 Repair](/guides/dism-restorehealth-offline-source/) · [Windows Update Error 0x800f0922, 0x80070002, 0x80073712: Fixes](/guides/windows-update-error-0x800f0922/) · [Disk full on a production server: recovery runbook](/guides/runbook-disk-full/) · [WSUS Windows Server 2025: Reliable Install and Configuration](/guides/wsus-windows-server-2025/) · [Server Inventory Report](/scripts/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.
