Skip to content

About

A modern desktop interface for Windows 10 and 11's built-in system repair tools (DISM and SFC). With one click and zero terminal typing, it scans the Windows Component Store and core system files for corruption, repairs damage only when found, and safely cleans up superseded update files with live progress bars, Dark/Light themes, and log export.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Component Store Maintenance (Repair-WindowsComponentStore)

A modern, zero-dependency Fluent Design desktop application for Windows 10 and Windows 11 that guides you through Windows Component Store (WinSxS) diagnostics, system file verification, and safe component cleanup—without touching a terminal or memorizing command-line switches.

PowerShell Gallery PowerShell Gallery Downloads License: MIT Platform


Screenshot 2026-11-27 094115

Why This Was Made

Windows includes powerful built-in repair and maintenance utilities—DISM (Deployment Image Servicing and Management) and SFC (System File Checker)—but running them properly usually means opening an elevated Command Prompt, remembering exact flags (/Online /Cleanup-Image /ScanHealth, /RestoreHealth, /AnalyzeComponentStore, /StartComponentCleanup), and staring at a static text cursor wondering if the console froze.

Component Store Maintenance replaces that friction with an approachable, native-feeling Windows interface:

  • No commands to memorize: Launch the app and click Start Maintenance. Everything runs in the proper sequence automatically.
  • Smart, conditional execution: Instead of blindly running heavy repair or cleanup routines when your PC doesn't need them, it inspects your system first and only triggers /RestoreHealth or /StartComponentCleanup if corruption or reclaimable packages are actually found.
  • Clear visual feedback: Real-time step cards, progress bars, elapsed timers, and an expandable live command output drawer show exactly what Windows is doing at every stage.

Features

  • Guided 3-Stage Maintenance Pipeline:
    1. Component Store Health (DISM): Runs dism.exe /ScanHealth first, automatically transitioning to /RestoreHealth only if component store corruption is detected.
    2. System File Checker (SFC): Runs sfc.exe /scannow to verify and repair protected Windows system files.
    3. Component Store Cleanup (DISM): Runs dism.exe /AnalyzeComponentStore and executes /StartComponentCleanup only when Windows reports that cleanup is recommended.
  • Native Windows 10 & 11 Fluent Design: Built in pure WPF with Windows 11 Mica backdrop support, live Windows accent color matching, and an Auto / Light / Dark theme switcher.
  • Automatic Elevation & STA Handling: Automatically requests Administrator privileges via UAC and safely spawns an STA thread if launched from an MTA host.
  • Live Command Output & Log Export: Expand the output drawer anytime to inspect raw DISM/SFC output, copy it to your clipboard, or save a timestamped .log file.
  • Smart Restart Prompt: Alerts you with a one-click Restart PC button only when repairs were actually applied.
  • Zero External Dependencies: Single self-contained .ps1 file compatible with both Windows PowerShell 5.1 and PowerShell 7.x.

Installation

Option 1: Install from PowerShell Gallery (Recommended)

Open PowerShell and run:

Install-Script -Name Repair-WindowsComponentStore -Force

Once installed, you can launch it from any PowerShell prompt by running:

Repair-WindowsComponentStore.ps1

To open the window and begin maintenance immediately without clicking Start Maintenance, pass -AutoStart:

Repair-WindowsComponentStore.ps1 -AutoStart

Option 2: Download from GitHub

  1. Download Repair-WindowsComponentStore.ps1 from the GitHub repository.
  2. Save it to a permanent folder (for example, C:\Scripts\Repair-WindowsComponentStore.ps1).
  3. Right-click the file and select Run with PowerShell, or run it from a PowerShell terminal:
.\Repair-WindowsComponentStore.ps1

Creating a Desktop Shortcut

Because PowerShell scripts open in Notepad by default when double-clicked, creating a desktop shortcut makes launching Component Store Maintenance feel like any other Windows app.

Option 1: Use PowerShell Desktop Shortcut Creator (GUI)

For the easiest setup with automatic icon extraction and execution policy handling, use PowerShell Desktop Shortcut Creator:

  1. Download or install PowerShell Desktop Shortcut Creator.
  2. Browse to Repair-WindowsComponentStore.ps1 (if installed via PowerShell Gallery, it is typically located in C:\Program Files\WindowsPowerShell\Scripts\ or C:\Program Files\PowerShell\Scripts\).
  3. Optionally add -AutoStart in the arguments field if you want double-clicking the shortcut to start scanning immediately.
  4. Click Create Shortcut.

Option 2: Create a Shortcut via PowerShell

Run the following snippet in PowerShell to locate Repair-WindowsComponentStore.ps1 and create a clean desktop shortcut (without a flashing console window):

$ScriptPath = (Get-Command Repair-WindowsComponentStore.ps1 -ErrorAction SilentlyContinue).Source
if (-not $ScriptPath) {
    $ScriptPath = "C:\Scripts\Repair-WindowsComponentStore.ps1" # Update if saved manually elsewhere
}

$PsExe = if (Get-Command pwsh.exe -ErrorAction SilentlyContinue) {
    (Get-Command pwsh.exe).Source
} else {
    "$env:WINDIR\System32\WindowsPowerShell\v1.0\powershell.exe"
}

$DesktopPath = [Environment]::GetFolderPath("Desktop")
$ShortcutPath = Join-Path $DesktopPath "Component Store Maintenance.lnk"

$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($ShortcutPath)
$Shortcut.TargetPath = $PsExe
# Add -AutoStart after `"$ScriptPath`" if you want maintenance to start immediately on launch
$Shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$ScriptPath`""
$Shortcut.WorkingDirectory = Split-Path $ScriptPath -Parent
$Shortcut.Description = "Scan, repair, and clean up the Windows Component Store (WinSxS)"
$Shortcut.IconLocation = "$env:WINDIR\System32\imageres.dll,102"
$Shortcut.Save()

Tips & Best Practices

  • DISM Progress Jumps Are Normal: During /RestoreHealth and /StartComponentCleanup, Windows DISM commonly pauses at 20% or 70% for a couple of minutes before jumping straight to 100%. The app is still working—watch the elapsed timer in the top-right card to confirm activity.
  • Keep Your Internet Connection Active: If Step 1 detects component store corruption, DISM /RestoreHealth downloads clean replacement files from Windows Update by default.
  • Reboot When Prompted: If DISM or SFC repairs damaged system files, Windows stages pending file replacements that finish applying on the next reboot. Use the Restart PC button in the bottom bar when prompted.
  • One-Click Routine Maintenance: Add -AutoStart to your desktop shortcut arguments if you want a single double-click to launch, scan, repair, and clean up automatically.

Troubleshooting

Script Fails to Launch or Closes Immediately

If a startup error occurs before the WPF window renders, the script displays an error dialog and writes a full stack trace to:

%TEMP%\WinSxS-Maintenance-Error.log

Check that file for exact details if the window fails to open.

Execution Policy Blocks the Script

If running Repair-WindowsComponentStore.ps1 directly in PowerShell is blocked by your system's execution policy, allow locally installed and signed scripts for your user account:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

DISM /RestoreHealth Fails with Error 0x800f081f (Source Files Not Found)

This happens when Windows Update cannot supply the repair files (for example, when offline, behind a strict WSUS policy, or on a mismatched build).

  1. Ensure you have an active internet connection and Windows Update is not paused or blocked.
  2. Alternatively, mount a matching Windows 10/11 ISO and run DISM manually pointing to its sources\install.wim or install.esd file, then re-run Component Store Maintenance.

SFC Reports "Unable to fix some of them"

If Step 2 completes with a Partial warning:

  1. Restart your computer so any repairs made by Step 1 (DISM /RestoreHealth) finish committing.
  2. Run Component Store Maintenance a second time—SFC can often repair remaining files once DISM has restored the underlying component store cache.
  3. If the warning persists, inspect C:\Windows\Logs\CBS\CBS.log for [SR] Cannot repair member file entries.

Repair-WindowsComponentStore.ps1 Is Not Recognized After Install-Script

Ensure your PowerShell Scripts directory is in your $env:PATH, or run the script using its full path:

  • PowerShell 7: $env:ProgramFiles\PowerShell\Scripts\Repair-WindowsComponentStore.ps1 * Windows PowerShell 5.1: $env:ProgramFiles\WindowsPowerShell\Scripts\Repair-WindowsComponentStore.ps1

Changelog

v2.0.4

  • Added explicit 100% completion snap and a 1.5-second cancellable transition state between ScanHealth -> RestoreHealth (Step 1a -> 1b) and AnalyzeComponentStore -> StartComponentCleanup (Step 3a -> 3b).
  • Updated Hero and Step Card titles/badges to clearly indicate when analysis/scanning has finished and repair/cleanup is beginning.

v2.0.3

  • Fixed Set-BrushResource by updating existing XAML SolidColorBrush.Color in-place to prevent PowerShell PSObject wrapping inside ResourceDictionary.

v2.0.2

  • Fixed WPF XamlReader.Parse ControlTemplate storyboard targeting on RenderTransform (which caused a silent crash on launch).
  • Added startup error dialog and %TEMP%\WinSxS-Maintenance-Error.log fallback so errors never fail silently.
  • Removed unused System.Drawing and System.Windows.Forms assembly loads.

v2.0.1

  • Replaced non-ASCII characters in strings with pure ASCII so PowerShell 5.1 parses cleanly even when saved as UTF-8 without BOM.
  • Switched live Windows theme/accent change detection to an HwndSource message hook on the UI thread.

v2.0.0

  • Upgraded to a zero-dependency Fluent Design WPF application matching Windows 10/11 native styling.

v1.0.0

  • Initial console release.

License

Licensed under the MIT License — Copyright (c) 2026 Danny Wareham (waresoft / 2civics).

About

A modern desktop interface for Windows 10 and 11's built-in system repair tools (DISM and SFC). With one click and zero terminal typing, it scans the Windows Component Store and core system files for corruption, repairs damage only when found, and safely cleans up superseded update files with live progress bars, Dark/Light themes, and log export.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages