Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / Windows 11 / How to Clean Up the WinSxS Folder on Windows

May 7, 2026

How to Clean Up the WinSxS Folder on Windows

When analyzing the free space usage on the system drive in Windows, many users discover that the WinSxS  (%windir%\WinSxS). directory takes up a significant amount of space. In this article, we’ll explain what is stored in the WinSxS system folder and how to clean it properly.

Contents:
  • How to Get the Actual Size of WinSxS Folder on Windows
  • Automatic Component Store Clean Up with a Task Scheduler
  • How to Clean Up the Component Store (WinSxS) on Windows
  • Remove Unused Roles and Features from Windows Image
  • How to Enable NTFS Compression on WinSxS Folder on Windows

The C:\Windows\WinSxS (Windows Side-by-Side) directory contains the Windows component store. This directory stores the DLL libraries, binaries, and XML files required for installing and operating various Windows roles and features, both those that are installed and those that are available for installation. When Windows updates are installed, certain system component files are replaced with newer versions, while superseded file versions are retained in the WinSxS component store. This allows you to safely uninstall any Windows update and roll back to the previous version of the component.

list of files in winsxs on windows 10

Another drawback of this architecture is that the WinSxS directory size continuously grows, as it retains all superseded component versions.

winsxs folder size in windows

The size of the WinSxS folder should typically not exceed 10-15 GB. If the WinSxS directory size on your computer is significantly larger, run the cleanup procedure.

You should never manually delete files from the WinSxS folder. These actions could damage your Windows image. Instead, use one of the built-in WinSxS folder cleaning methods described below.

How to Get the Actual Size of WinSxS Folder on Windows

The easiest way to get the current size of the WinSxS folder on Windows is to open the properties of the %windir%\WinSxS folder in File Explorer (or use a PowerShell script to check the size of a folder). But keep in mind that most file managers (including File Explorer) show a slightly larger WinSxS folder size than it takes on disk.

The fact is that the WinSxS directory contains a large number of hard links (symbolic links) to system files in other folders. File managers take into account the size of files referenced by hard links when calculating the size of the WinSxS folder, but this is not correct.

You can use the du tool from Sysinternals to find out the real size of the WinSxS folder on disk. du -v c:\windows\winSXS
how to check the real size of winsxs folder using du tool

You can also analyze the size of the component store in the WinSxS folder using the DISM command:

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore - reporting winsxs folder real size

Let’s see what this command returns:

Component Store (WinSxS) information:

Windows Explorer Reported Size of Component Store11.30 GBThis is the component size, including hard links, as displayed in File Explorer.
Actual Size of Component Store11.12 GBThe actual size of the component store, excluding hard links.
Shared with Windows6.66 GBThese are mandatory system files. Cannot be deleted.
Backups and Disabled Features4.46 GBThese are superseded component files that may be needed if there are problems with installed updates.
Cache and Temporary Data0 bytesTemporary files used by Windows to speed up servicing, updates, and cleanup operations
Date of Last Cleanup2026-04-04 11:20:19
Number of Reclaimable Packages1These are components whose files were updated (replaced) after installing Windows updates. You can safely remove old versions of these component files when cleaning up the component store.
Component Store Cleanup RecommendedYes/No

In my case, I can reduce the size of the WinSxS folder by 4.5 GB.

This command can be used to display a list of old versions of components in the image that can be removed:

Dism /Online /Get-Packages /Format:Table

List superseded packages in windows image

Packages with a Superseded status have been replaced by newer updates and can be removed. For manual superseded package removal, use the command: Dism /Online /Remove-Package /PackageName:PACKAGE_Full_Name. However, there is no need to use it since an automatic cleaning procedure is in place (see below).

Automatic Component Store Clean Up with a Task Scheduler

The StartComponentCleanup task is a preconfigured Windows Task Scheduler task that regularly optimizes and cleans up the WinSxS folder by removing old or superseded system components. It is set to run automatically during system idle time (as a part of the image maintenance servicing tasks), waiting 30 days after an update has been installed before removing superseded component versions. This gives the user time to roll back to the previous version if there are any issues with the new update.

Use either the Task Scheduler taskschd.msc snap-in or PowerShell to ensure that this scheduled task exists and is enabled, and to check when it last ran:

Get-ScheduledTask StartComponentCleanup

Get-ScheduledTask StartComponentCleanup | Get-ScheduledTaskInfo

Scheduled task - StartComponentCleanup

To run the scheduler task manually, use the command:

Start-ScheduledTask StartComponentCleanup

StartComponentCleanup task

How to Clean Up the Component Store (WinSxS) on Windows

To initiate the immediate clean-up of the Windows Component Store to remove superseded file versions, bypassing the 30-day expiration period, run the following command:

Dism.exe /Online /Cleanup-Image /StartComponentCleanup

clenup winsxs component store with Dism StartComponentCleanup

The command searches for superseded components and removes old, unused versions of system files. DISM also applies delta compression to superseded components, converting them into compact difference files.

Once the cleanup is complete, check the current size of the component store:

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

In my example, the size of the WinSxS folder was reduced by 4.5 GB.

The /StartComponentCleanup option includes a /ResetBase option that enables the removal of all superseded component versions remaining after Windows update installations.

After that, it will no longer be possible to uninstall installed Windows updates or service packs.

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

In Windows 7 and Windows Server 2008 R2, an additional DISM option was introduced to remove old component versions that remained after service packs were installed:

DISM /online /Cleanup-Image /spsuperseded

Also, you can use the graphical Disk Cleanup wizard to remove old update files:

  1. Run the cleanmgr command as an administrator.
  2. Select the disk and in the next window, click the “Clean up system files” button.Clean up system files
  3. Then select the “Windows update cleanup” option. The Disk Cleanup tool shows how much disk space can be freed up by deleting old Windows update files. In my example, it is about 320 MB. Click OK to start the cleanup.Windows update cleanup using cleanmgr tool

The new Storage Sense cleanup option is available in the Windows 11 Settings panel under System > Storage > Temporary Files.  Check the option Windows Update Cleanup to remove previous update files.

Windows update cleanup in storage sense

Remove Unused Roles and Features from Windows Image

As part of the Features on Demand (FoD) concept, Windows enables you to remove the binaries of any unused roles and components from the component store (WinSxS directory).

Use the command below to list all the features available in a Windows image:

DISM.exe /Online /Get-Features /Format:Table

dism: disable windows feature with remove payload removed

By default, only the .Net Framework 3.5 feature is removed from the Windows 10 and 11 images (It can always be installed manually).

To remove, for example, the TelnetClient feature from the Windows image (from the WinSxS folder), run the command: DISM.exe /Online /Disable-Feature /Featurename:TelnetClient /Remove
DISM Disable Feature Remove

If you list all the available on-demand features in Windows now, you will see that the status of the component has changed to Disabled with Payload Removed.

In Windows Server, the Uninstall-WindowsFeature PowerShell cmdlet is used to remove role and feature files from disk.

Thus, you can reduce the size of the WinSxS folder in Windows by removing unused features from the disk. If necessary, you can always install removed features via Windows Update or from an installation ISO image.

The DISM command also allows you to check and repair your Windows image:

DISM /Online /Cleanup-Image /RestoreHealth

How to Enable NTFS Compression on WinSxS Folder on Windows

There’s another (unofficial) way to reduce the size of the WinSxS directory on Windows: compress its contents at the NTFS file system level. This can reduce the space occupied by the WinSxS directory by up to 30%.

This compression method is effective in Windows 10 but has almost no impact in Windows 11.

Note. As with any non-standard change to the system configuration, it is strongly recommended that you create a full backup of your Windows image.
  1. Open the command prompt as administrator.
  2. Stop and disable the Windows Installer and Windows Module Installer services:
    sc stop msiserver
    sc stop TrustedInstaller
    sc config msiserver start= disabled
    sc config TrustedInstaller start= disabled
  3. Backup the Access Control Lists (ACLs) assigned to the files and folders in the WinSxS directory using the built-in icacls command. An ACL backup is a plain text file containing a list of all the files and directories, along with the NTFS permissions assigned to each one (later, this file will be needed to restore the original ACLs):
    icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS_NTFS.acl" /t
    backup ntfs permissions of winsxs folder files using icacls
  4. Make yourself the owner of the WinSxS folder and all its subfolders:
    takeown /f "%WINDIR%\WinSxS" /r
  5. Grant your account full control permissions on the WinSxS directory:
    icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
  6. You can now use the compact command to compress files in the WinSxS directory. Because some of the files can be used by the system, you need to specify the /I option. Otherwise, the compression process will stop at the first locked file (in Windows 10 and 11, you can use more advanced LZX compression):
    compact /s:"%WINDIR%\WinSxS" /c /a /i *
    compressing files in the winsxs folder using the compact.exe tool
  7. Restore the owner of the WinSxS directory back to TrustedInstaller:
    icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
  8. Restore the original ACLs for the WinSxS folder items using the ACL backup file you created earlier:
    icacls "%WINDIR%" /restore "%WINDIR%\WinSxS_NTFS.acl"
  9. Restore the default startup type for the Windows Installer and Windows Module Installer services:
    sc config msiserver start= demand
    sc config TrustedInstaller start= demand

Check the current size of the WinSxS directory.

how to saves pace on winsxs folder on windows 10?

As shown in the example provided, the size of the WinSxS folder decreased by around 30% (from 9.4 GB to 6.5 GB) after compression. Not bad, especially for a small-sized SSD drive.

The specified commands can be executed one by one (making it easier to track the results of each one), or they can be combined into a single script file. You can download the ready-to-use batch file to enable NTFS compression for items in the WinSxS folder here: winsxs_ntfs_compress.bat

You should run this script regularly, as new uncompressed files will appear in the WinSxS folder when you install new Windows updates or features.

What can be affected by compressing the WinSxS folder? Windows works seamlessly with compressed files. However, processing such files may require additional CPU time for decompression/compression. This may cause a slight slowdown when installing Windows features or updates. However, modern CPUs execute file compression and decompression operations nearly instantaneously, so users may not notice any significant impact on performance.
22 comments
5
Facebook Twitter Google + Pinterest
Windows 10Windows 11Windows Server 2022
previous post
Mapped Network Drives are Not Showing in Elevated Programs
next post
Windows Defender Threat Service Has Stopped, Restart It Now

Related Reading

How to Repair Windows Boot Manager, BCD and...

March 11, 2024

PowerShell: Get Folder Size on Windows

April 2, 2024

Fix: The Computer Restarted Unexpectedly or Encountered an...

May 16, 2024

How to Download Offline Installer (APPX/MSIX) for Microsoft...

February 20, 2026

Network Computers are not Showing Up in Windows...

March 15, 2024

Windows Doesn’t Automatically Assign Drive Letters

March 15, 2024

How to Clean Up System Volume Information Folder...

March 17, 2024

Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)

March 17, 2024

22 comments

Maxim September 15, 2014 - 10:25 pm

Thank you very much!

Reply
fox October 22, 2014 - 8:23 pm

I tried your solution, but step 8 “Recover original ACLs to the WinSxS directory” failed with the following messages:
C:\Windows\WinSxS\Manifests\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.42_none_db5f52fb98cb24ad.cat: Access denied.
Successfully Processed 20618 files; Failed to process 1 file.

In fact it failed to process 24000 files because it aborted due to the Access Denied failure.
I tried to re-run the instruction and edited that line so it could pass that phase and it only processed 4 files more and failed again.

Are you able to hint how to proceed from now?

Reply
Max October 23, 2014 - 4:07 am

Check current permission on file x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.42_none_db5f52fb98cb24ad.cat. Try take ownership of file and grant your account full rights to it. Next repeat step 8 again.
Or manually set the permissions on the file in accordance with the data in the file WinSxS_NTFS.acl

Reply
Rob Donovan November 8, 2014 - 2:19 pm

Hi,

It also failed on me with the restoring ‘TrustedInstaller’ part, saying access denied.

I presume this is because the first steps gave my user Ownership, but, we didnt add my user as a user to the actual permissions.

So, when you try to change back to TrustedInstaller, your user doesnt have the access to do that. Atleast that is how I see it.

So, I had to run this instead, to get back to TrustedInstaller Owner:

icacls “%WINDIR%\WinSxS” /grant Rob:(F) /t /c
icacls “%WINDIR%\WinSxS” /setowner “NT SERVICE\TrustedInstaller” /t /c
icacls “%WINDIR%\WinSxS” /remove Rob /t /c

It gives my user ‘Rob’ fullcontrol first, then changes to TrustedInstaller, and then finally removes my user permission for ‘Rob’.

Replace ‘Rob’ with whatever your username is.

It seems that even though you can take ownership and then do things, you dont have permission to change ownership back, unless you give your user ‘Full control’ permissions.

HTHs,

Rob.

Reply
Max November 12, 2014 - 7:26 am

Hi, Rob!
Thanks for your comment, but we give current user Full Control permission on step 5, then execute command:
icacls “%WINDIR%\WinSxS” /grant “%USERDOMAIN%\%USERNAME%”:(F) /t
You must just replace %USERDOMAIN%\%USERNAME% on your username

Reply
patrick November 15, 2014 - 12:52 pm

I’m sorry but compressing winSXS seems to increase size on disk? in my case it does 🙁
winSXSfolder shows decrease size on disk, but when I check the drive full size it actually increased.

Reply
patrick November 15, 2014 - 1:04 pm

my mistake, forgot to restart PC now it shows correct size 🙂

Reply
genetix December 3, 2014 - 9:07 am

Extremely good looking guide. Most be one and only on web to go through this deep analyze of how to go further in data usage.
Honestly, since Microsoft is being a brick while operating systems with full support should take less than 500MB in size while online and then consider what people actually wants to use in os the whole idea of increasing size to raise hardware market supported by all new hardware manufacturers is good for marketing, but there should be some system ripped to WinPE level where only thing that should take space is few KB driver base for all devices, but since now days a simply 500KB audio driver can turn to 250MB totally idiotic bloatware it’s hilarious really. Sadly this is possible at linux side, but Microsoft sure is enjoying the install size being around 20-30GB in full with only barebone components in the machines.

Reply
Ricardo Fort December 3, 2015 - 1:24 am

To solve the “sc config msiserver start= demand” Access is denied, use NSudo and run the same command again:
sc config msiserver start= demand

Reply
Dan Dar3 August 7, 2016 - 2:55 pm

Nice one Woshub.com, simply lifting the WinSXS compressing part from my blog and not giving any credit! http://dandar3.blogspot.com/2013/01/how-to-ntfs-compress-windows-winsxs.html

Reply
Junior November 17, 2016 - 4:05 pm

Does this work with windows server 2008 sp2?

Reply
admin November 30, 2016 - 7:00 am
  • “Features on Demand” appeared only in Windows Server 2012 / Win 8
  • To use DiskCleanup tool you nee to install update KB2852386 (http://support.microsoft.com/kb/2852386))
  • You can compress WinSxS folder this way in any supported version of Windows
Reply
Kent April 15, 2019 - 2:21 am

KB2852386 is for Server 2008 R2. Is not applicable to Server 2008 SP2. For Server 2008 SP2, use Compcln.exe.

Reply
TheNetAvenger October 23, 2018 - 2:44 pm

This is a great guide.

You might want to update and mention that current versions of Windows 10 automatically clean up the WinSXS folder – and note which things you mention are not a part of the automatic cleanup.

As Microsoft states from their cleanup Doc…
“Windows 10 and Windows Server 2016 automatically reduce the size of the WinSxS folder by using methods similar to the ones described in this topic, in addition to 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.”

This might help users, so they aren’t taking time to repeat steps that Windows 10 is now doing for them. It might also help with confusion when the size doesn’t change, and to know when they can still rollback items.

Reply
admin October 30, 2018 - 5:57 am

Do you talk about a task named StartComponentCleanup (located in the task scheduler section \Microsoft\Windows\Servicing)? This task deletes replacement packages files older than 30 days.

Reply
Martin January 3, 2019 - 1:17 pm

When you issue `compact /s:”%WINDIR%\WinSxS” /c /a /i` instead of `compact /s:”%WINDIR%\WinSxS” /c /a /i *`, the WinSxS directory *itself* will be marked as “compressed”, too. This means any newly created subfolders and files will be compressed right from the start and it’s no longer necessary to run this script periodically.

Reply
Gigamegs July 26, 2019 - 4:30 pm

> icacls “%WINDIR%\WinSxS” /grant “%USERDOMAIN%\%USERNAME%”:(F) /t

Didn’t work for me instead use: icacls “%WINDIR%\WinSxS” /grant User:F /t

[1]https://stackoverflow.com/questions/2928738/how-to-grant-permission-to-users-for-a-directory-using-command-line-in-windows

Reply
Anders Lindström October 9, 2019 - 7:04 am

Very good article. Helped me 100%.
Before 100Mb, after 8Gb.

Reply
Paul November 5, 2019 - 10:47 pm

This should be included script in the Citrix Optimization tool and BASE Image Script Framework for non-persistent virtual desktops. Reduced free space from 3.42GB to 6.47GB saving limited server SSD intellicache for our six servers. Great work, Thank you.

Reply
Serg April 22, 2021 - 4:53 pm

On the web you can find in another script that allows to reduce the size of the WinSxS folder — WinSxSLite (by Christian Bering Boegh). According to the developer, this script searches the latest version on dll files in WinSxS, makes symbolic links to them from all previous versions and removes the old file versions. It is no recommended to use WinSxSLite, because in spite of the idea being good, the result of running the script is unpredictable, and though the WinSxS folder size is reduced, some Windows components can be damaged

Reply
Josean Rodriguez May 24, 2021 - 10:21 am

Hi!
I made a deeply cleanup from Windows 10, and now, I cant install Windows Media Player, is not the files to enable via powershell this feature.

It’s possible to reinstall Features and apps deleted in Winsxs and made possible reinstall it?

Thanks

Reply
Ricardo October 9, 2022 - 1:53 am

Great!!! Really helpful!

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • How to Safely Disable IPv6 on Windows

    April 30, 2026
  • Updating UEFI Secure Boot Certificates on Windows Devices Explained

    April 20, 2026
  • Security Warnings When Opening RDP Files in Windows 11

    April 17, 2026
  • Find Computers with Pending Reboot Status Using PowerShell

    April 15, 2026
  • Mounting NFS Shares in Windows Using the Built-in Client

    March 26, 2026
  • Monitor Windows Log Files in Real Time with PowerShell

    March 17, 2026
  • Pin and Unpin Apps to Taskbar in Windows 11 via PowerShell

    March 10, 2026
  • Load and Initialize Network Drivers in Windows PE or Recovery Environment

    February 25, 2026
  • How to Set a Custom Drive Icon in Windows

    February 17, 2026
  • Managing Per-User Services in Windows

    February 11, 2026

Follow us

  • Facebook
  • Twitter
  • Youtube
  • Telegram
Popular Posts
  • How to Repair EFI/GPT Bootloader on Windows 10 or 11
  • How to Restore Deleted EFI System Partition in Windows
  • Network Computers are not Showing Up in Windows 10/11
  • Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)
  • How to Download Offline Installer (APPX/MSIX) for Microsoft Store App
  • How to Update Trusted Root Certificates in Windows: Manual and Automatic Methods Explained
  • Fix: Windows Cannot Connect to a Shared Printer
Footer Logo

@2014 - 2026 - Windows OS Hub. All about operating systems for sysadmins


Back To Top