Windows Updates that keep failing, system tools that crash, features that won’t install, strange errors after a power loss or interrupted update: these often trace back to corrupted system files or a damaged component store (WinSxS). Windows includes two repair tools for this: SFC (System File Checker) and DISM (Deployment Image Servicing and Management). Here’s how to use them, in the right order, on Windows Server and Windows 10/11.

Run all commands in an elevated Command Prompt or PowerShell (Run as administrator). On a Windows VPS, connect via RDP, or use the VNC console if RDP doesn’t work. See Windows VPS.

The order: DISM first, then SFC

  • SFC repairs protected system files using copies from the component store.
  • DISM repairs the component store itself, from Windows Update or an installation source.

If the component store is damaged, SFC can’t fix files (“found corrupt files but was unable to fix some of them”). So repair the store with DISM first, then run SFC.

Step 1: DISM health checks

DISM /Online /Cleanup-Image /CheckHealth

A quick check of whether corruption was already flagged.

DISM /Online /Cleanup-Image /ScanHealth

A deeper scan, which takes several minutes.

DISM /Online /Cleanup-Image /RestoreHealth

This repairs the component store by downloading clean files from Windows Update. It can take 10–30 minutes and may seem stuck at 20% or 62% for a while. Let it finish.

Expected result: The restore operation completed successfully.

Step 2: SFC

sfc /scannow

The possible results:

  • “did not find any integrity violations” — system files are fine.
  • “found corrupt files and successfully repaired them” — done. Reboot.
  • “found corrupt files but was unable to fix some of them” — run DISM /RestoreHealth again (with a source, below), then SFC again.

Reboot after repairs.

When DISM can’t download files: use a source

Servers without Windows Update access (WSUS-only, restricted outbound internet) fail with errors like 0x800f081f (“The source files could not be found”). Point DISM at installation media of the same version and build:

  1. Mount the Windows Server ISO (double-click it, or Mount-DiskImage C:\iso\server2022.iso). Note the drive letter, e.g. D:.
  2. Find the right image index:
DISM /Get-WimInfo /WimFile:D:\sources\install.wim
  1. Repair from it:
DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:\sources\install.wim:2 /LimitAccess

(install.esd sources use ESD: instead of WIM:. /LimitAccess stops it from trying Windows Update.)

The build of the source must match the installed build closely. Fully patched servers may need media of the same cumulative update level.

Read the logs

  • SFC: C:\Windows\Logs\CBS\CBS.log. Extract the SFC entries:
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log > "%userprofile%\Desktop\sfcdetails.txt"
  • DISM: C:\Windows\Logs\DISM\dism.log.

These show which files were corrupt or couldn’t be repaired.

Free space in the component store

Over time, WinSxS grows with superseded updates:

DISM /Online /Cleanup-Image /AnalyzeComponentStore
DISM /Online /Cleanup-Image /StartComponentCleanup

Add /ResetBase to remove all superseded versions. That frees more space, but installed updates can’t be uninstalled afterwards. Use it on stable servers after confirming the updates work. See disk space on Windows.

Fixing stuck Windows Updates

If updates still fail after DISM and SFC, reset the update components:

net stop wuauserv; net stop bits; net stop cryptsvc
Rename-Item C:\Windows\SoftwareDistribution SoftwareDistribution.old
Rename-Item C:\Windows\System32\catroot2 catroot2.old
net start cryptsvc; net start bits; net start wuauserv

Then retry updates. See Windows Update with PowerShell.

When repairs don’t help

  • Check disk health and free space first. A full or failing disk causes repeated corruption.
  • Check the event logs (System and Application) for disk, NTFS or memory errors.
  • In-place upgrade repair (run setup from the same-version ISO, keeping files and apps) fixes deep corruption on many Windows versions.
  • As a last resort, back up your data, reinstall Windows Server, and restore. On VPS.DO, you can reinstall the OS from the control panel (it erases the disk, so back up first).

Quick reference

Task Command
Quick check DISM /Online /Cleanup-Image /CheckHealth
Deep scan DISM /Online /Cleanup-Image /ScanHealth
Repair store DISM /Online /Cleanup-Image /RestoreHealth
Repair from ISO … /RestoreHealth /Source:WIM:D:\sources\install.wim:N /LimitAccess
Repair files sfc /scannow
Logs CBS.log, dism.log
Clean WinSxS DISM /Online /Cleanup-Image /StartComponentCleanup

Related: RDP black screen fix and Windows Server 2022 setup.

  • Windows
  • Windows Server
  • Troubleshooting