Monday, August 10, 2026

Reclaim Space from WinSxS using CMD

 



What is WinSxS? 

WinSxS (short for Windows Side-by-Side) is the official Windows Component Store, located at C:\Windows\WinSxS. It acts as the core file repository for the Windows operating system.

Instead of keeping system files scattered across various directories, Windows stores the master copies of all system components, drivers, optional features, and updates inside WinSxS.

What WinSxS Is Used For

  1. Side-by-Side Execution ("DLL Hell" Prevention):

    It allows different applications to run different versions of the same system DLL or assembly simultaneously without overwriting or interfering with one another.

  2. Windows Updates & Rollbacks:

    When Windows installs an update, it adds the new version of a file to WinSxS while preserving the old version. This allows you to safely uninstall updates if something goes wrong.

  3. Enabling/Disabling Windows Features:

    Features like Hyper-V, IIS, or .NET Framework 3.5 can be enabled or disabled instantly without inserting installation media because the files are already staged in WinSxS.

  4. System Repair:

    Built-in repair commands like sfc /scannow and dism /online /cleanup-image /restorehealth use WinSxS as the reference folder to repair corrupt or missing system files.



Check if you need Cleanup

A. The DISM Command Line (Most Thorough)

Open PowerShell or Command Prompt as Administrator:

  1. Analyze WinSxS to see actual reclaimable space:

    DOS
    Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
    
  2. Clean up superseded component versions:

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

    (Note: Using /ResetBase permanently commits installed updates and prevents you from uninstalling current updates, but yields the maximum disk space recovery).



How to Run the Cleanup

Run one of the following commands in an Elevated Command Prompt or Elevated PowerShell (Run as Administrator):

Option 1: Standard Recommended Cleanup (Safe & Reversible)

Removes superseded components while keeping the ability to uninstall recent Windows Updates if needed:

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

Option 2: Maximum Space Reclamation (/ResetBase)

Purges all older versions of components completely. This yields the maximum possible disk space savings, but removes the ability to uninstall currently installed Windows Updates:

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

What to Expect

  • The process can take anywhere from 5 to 20 minutes depending on your CPU and drive speed.

  • It may appear to pause at certain percentage marks (like 10% or 20%)—this is normal while it processes hard links and file references in the background.