How to use DISM to Check and Repair Windows Image from recovery console

Often there a situation of operating system failed to boot because of sudden power lost or unexpected reboot. in those cases you will need to fix the windows boot mechanism, I have wrote a post on how to fix boot in windows it can be found here :

https://itsimple.info/?p=1937

how ever in extreme cases you will need to check the operating system files as well. 2 tools allow to you aid SFC (System File Checker) & DISM . the most common option is to run :

SFC /scannow

This command will scan protected operating system and will try to fix them in case they are broken . command returns the error “Windows Resource Protection found corrupt files but was unable to fix some of them“, it is likely that the tool could not get the necessary files from the Windows Component Store. another option to run :

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

You can also repair single file

sfc /SCANFILE=C:\Windows\SysWow64\explorer.exe

Delete registry key for pending system repair

Step 1. Type regedit and select it from the start menu.

Step 2. In the registry editor, navigate to the following key.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RebootPending

Step 3. Right-click RebootPending key and selectDelete in the context menu.

Step 4. Exit this window and try SFC again.

SFC scannow not working system repair pending

You may also receive message: there is a system repair pending which requires reboot to complete. To fix it, you can try DISM RestoreHealth as mentioned above. If it does not work and you receive DISM doesn’t support servicing Windows PE with /Online option, you can try the following.

Run another DISM command

Step 1. Open cmd at boot.

Step 2. Type the following command and hit Enter.

dism.exe /image:c:\ /cleanup-image /revertpendingactions

In cases you wont be able to run those command you can try fixing the system with DISM :

Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth

The following errors can appear when running the DISM /RestoreHealth command:

  • Error: 50: DISM does not support servicing Windows PE with the /Online option – this means your DISM thinks you are using a WinPE image. To fix this, remove the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\MiniNT; (run regedit from the command prompt)
  • DISM Error 87: make sure the DISM command is written correctly, make sure you are using the DISM version for your Windows version (usually when booting in WinPE/ WinRE).

You can run this with offline option and any source of operating system location :

Dism /image:C:\ /Cleanup-Image /RestoreHealth /Source:D:\sources\install.wim

When D: is the installation disk

Tip. Here are some useful DISM parameters an administrator must know:

To repair an image

  1. Use the /RestoreHealth argument to repair the image. For example, to repair an offline image using a mounted image as a repair source, at a command prompt, type the following command:
Dism /Image:C:\offline /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows

Or to repair an online image using some of your own sources instead of Windows Update, type:

Dism /Online /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows /LimitAccess

If you do not specify a /Source for the repair files, the default location for Features on Demand is used. For more information, see Configure a Windows Repair Source. If you specify more than one /Source, the files are copied from the first location where they are found and the rest of the locations are ignored. You can use /LimitAccess to prevent the DISM tool from using Windows Update as a repair source or as a backup repair source for online images.

Good Luck

Leave a Reply

Your email address will not be published.