Knowledge base

Repair Windows offline with DISM and SFC

Use this guide when Windows no longer boots normally but the Windows volume is still readable from WinRE or Windows PE.

If the SSD is missing, hardware is clearly faulty or only EFI/BCD is damaged, use a different recovery route.

DISM checks and repairs the Windows image and component store. SFC checks protected system files against that store, so establish the store's health before moving on to SFC.

The examples use:

  • D: for the verified Windows volume;
  • E: for writable logs and temporary files;
  • F: for official Windows installation media.
Lees in het Nederlands →

Prerequisites

Continue only if:

  • important data is protected;
  • the SSD shows no clear signs of failure;
  • BitLocker can be unlocked;
  • the correct Windows volume has been identified;
  • enough free space is available for logs and scratch files.

1. Confirm that D: is Windows

dir D:\Windows
dir D:\Windows\System32
dir D:\Program Files
dir D:\Users

Stop if the contents do not match the installation you intend to repair. Find the correct drive letter with diskpart and list volume first.

2. Check BitLocker

manage-bde -status

The Windows volume must be accessible and, if encrypted, unlocked.

3. Read edition and package state

dism /Image:D:\ /Get-CurrentEdition
dism /Image:D:\ /Get-Packages /Format:Table

Expected: DISM opens the offline image and displays the Windows edition and registered packages.

If DISM cannot open the image, recheck the drive letter, BitLocker and file system before continuing.

4. Create log and scratch directories

mkdir E:\scratch
mkdir E:\logs

Use a writable location with enough free space.

5. Check the component store

dism /Image:D:\ /Cleanup-Image /CheckHealth
dism /Image:D:\ /Cleanup-Image /ScanHealth /ScratchDir:E:\scratch /LogPath:E:\logs\dism-scanhealth.log
  • CheckHealth reads an existing corruption flag.
  • ScanHealth performs a fuller check.
  • Neither command repairs the image.

6. Repair the component store

dism /Image:D:\ /Cleanup-Image /RestoreHealth /ScratchDir:E:\scratch /LogPath:E:\logs\dism-restorehealth.log

Possible results include:

  • DISM completes the repair;
  • no repairable corruption is found;
  • required source files cannot be found;
  • the image or selected source is not usable.

Do not force an arbitrary source if RestoreHealth fails.

7. Use matching official installation media if a source is required

Use this step if RestoreHealth needs source files. The official media must match the installed Windows in language, architecture, edition and component level. Choose the WIM or ESD route according to the file on your media; these are alternatives.

Source from install.wim

dism /Get-WimInfo /WimFile:F:\sources\install.wim

From the listed editions, select the matching index. Replace INDEX below with that number before running the repair:

dism /Image:D:\ /Cleanup-Image /RestoreHealth /Source:WIM:F:\sources\install.wim:INDEX /LimitAccess /ScratchDir:E:\scratch /LogPath:E:\logs\dism-restorehealth-source.log

Source from install.esd

dism /Get-WimInfo /WimFile:F:\sources\install.esd

From the listed editions, select the matching index. Replace INDEX below with that number before running the repair:

dism /Image:D:\ /Cleanup-Image /RestoreHealth /Source:ESD:F:\sources\install.esd:INDEX /LimitAccess /ScratchDir:E:\scratch /LogPath:E:\logs\dism-restorehealth-source.log

If you cannot establish a matching source and edition index, stop rather than trying an arbitrary one.

8. Check the component store again

dism /Image:D:\ /Cleanup-Image /ScanHealth /LogPath:E:\logs\dism-scanhealth-after.log

Run SFC after the component store no longer reports repairable corruption.

9. Run offline SFC

sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows

For a diagnosis that calls for checking one particular file, the following example verifies winlogon.exe:

sfc /verifyfile=D:\Windows\System32\winlogon.exe /offbootdir=D:\ /offwindir=D:\Windows

10. Keep the logs

Important logs are usually found in:

  • D:\Windows\Logs\CBS\CBS.log;
  • D:\Windows\Logs\DISM\dism.log;
  • files created with /LogPath.

Record the Windows volume, source, edition index and commands used.

DISM and SFC are clean but Windows still will not boot

Clean DISM and SFC results do not establish that Windows can boot. Choose the next check according to the failure that remains:

Stop if

  • DISM cannot open the image reliably;
  • the SSD reports I/O errors or disappears;
  • BitLocker cannot be unlocked;
  • you cannot establish a matching official repair source;
  • previous changes can no longer be reconstructed.

Do not use loose Windows DLLs or executables from third-party download sites as repair sources.

Need help? Contact Forcys →