DISM.exe /Online /Cleanup-Image /Restorehealth: Explained

DISM.exe /Online /Cleanup-Image /Restorehealth
Spread the love

What is DISM.EXE /Online /Cleanup-image /RestoreHealth?

“DISM.exe /Online /Cleanup-Image /Restorehealth” is a DISM command that repairs issue with the running Operating system you are logged into.

Before I go further to explain what “DISM.exe /Online /Cleanup-Image /Restorehealth” does, lets define DISM.exe first.

What is DISM.EXE?

DISM.exe (Deployment Image Servicing and Management) is a Windows command line tool that is used to manage both Windows Online and Offline Images.

DISM.exe /Online /Cleanup-Image /Restorehealth Explained

As I said in my introduction, this command fixes any problem(s) identified in your current operating system.

But what does each switch in this command do? I will explain the switches and put it all together for you.

Sponsored Content

DISM.exe /Online vs /Image

When you run DISM.exe command, you must either specify the /Online or /Image switch. If you specify the /Online switch, DISM.exe will not expect a path to an offline image. Rather, the command tool will target the running operating system.

On the other hand, if you specify the /Image switch, Deployment Image Servicing and Management tool will expect you to specify the path to the root directory of an offline Windows image.

Important Tip

DISM.exe supports Windows image (.wim) file or virtual hard disk (.vhd or .vhdx) as offline images.

So, DISM.exe /Online switch means you are asking DISM to target the running Operating system instead of an offline image. In the next section, I will explain the /Cleanup-Image switch.

DISM.exe /Cleanup-Image

For DISM.exe command to work, the /Online or /Image switch must be followed by other image servicing commands. One of the command line options for the DISM.exe /Online switch is the /Cleanup-Image switch.

So, what does the /Cleanup-Image switch do in our “DISM.exe /Online /Cleanup-Image /Restorehealth” command? The /Cleanup-Image switch performs cleanup and recovery operations on the running Operating System.

To put it together to this point: when you run the command “DISM.exe /Online /Cleanup-Image”, you are asking Deployment Image Servicing and Management tool to:

  1. Target the running Operating System
  2. Perform cleanup and recovery operations on the running Operating System

DISM.exe /Restorehealth

The last switch in “DISM.exe /Online /Cleanup-Image /Restorehealth” command is the /Restorehealth switch. The /RestoreHealth switch scans the Operating System for corrupt files. If DISM finds corrupt files, it attempts to repair them automatically.

Important Tip

When you run the command ” DISM.exe /Online /Cleanup-Image /Restorehealth”, it may appear to be stuck. Do not panic. Give it sometime. It will usually complete.

What Does “DISM.exe /Online /Cleanup-Image /Restorehealth” Do?

With the 3 switches in the command explained, I can summarize what the command does.

When you run DISM.exe /Online /Cleanup-Image /Restorehealth command, it does the following:

  1. The /Online switch instructs DISM.exe to target the running Operating System instead of an offline Windows image (.wim) file or virtual hard disk (.vhd or .vhdx)
  2. The /Cleanup-Image switch performs cleanup and recovery operations on the running Operating System
  3. Finally, the /Restorehealth switch scans the running Operating System for corrupt files and attempts to fix them.

Below is the result of the command.

DISM.exe /Online /Cleanup-Image /Restorehealth - (Deployment Image Servicing and Management)

How to Use DISM.EXE to Check Your Operating System Health

I suppose by now, you are probably thing “can DISM.exe help me find problems in my OS?” Yes, it can! If you are having problems with your Windows computer, use the /ScanHealth switch to perform advanced scan. See the command below:

DISM /Online /Cleanup-Image /ScanHealth

The result of the command is shown in the image below:

DISM.exe /Online /Cleanup-Image /Restorehealth - (Deployment Image Servicing and Management)

Sponsored Content

Run DISM.EXE from Windows 10 Recovery Mode

Sometimes Windows may not even boot. If you wish to repair your Windows 10 computer that does not boot at all, use the steps below:

  • Download Windows 10 ISO, burn it into a DVD and boot your computer with it. For a step by step guide on how to download Window 10 ISO image, read Download Windows 10 ISO Image.
  • When your computer boots to the screen shown below, press any key to boot into the Windows 10 DVD.

DISM /Online /Cleanup-Image /RestoreHealth /Source:< path-to-install.wim>

  • On the Windows Setup screen, click Next. Then click Repair your computer.

DISM /Online /Cleanup-Image /RestoreHealth - Deployment Image Servicing and Management

  • Next, click Troubleshoot. Then click Command Prompt.

Sponsored Content

  • Command Prompt loads.

Important Tip

To repair Windows 10 from the ISO, we require Install.WIM. Unfortunately, Install.WIM is not readily available in Windows 10 ISO. It has to be extracted.

Extract Install.WIM from Windows 10 ISO

As I said earlier, before you can use DISM /Online /Cleanup-Image /RestoreHealth command with a WIM file, the file has to be extracted.

Follow the steps below to extract the OS WIM file from install.esd:

  • First, you need to determine the drive your ISO image was mounted. This will depend on the number of drives on your computer. Knowing that it cannot be drive C, try D, then E and so on.
  • To change to a drive, enter the drive name, followed by colon then press Enter.
  • Next, type Dir and press the Enter key.
DISM /Online /Cleanup-Image /RestoreHealth - Deployment Image Servicing and Management

Keep checking possible drive letters until you find the one with folders, boot, efi, sources and support. This is the drive your Windows 10 ISO is mounted.

  • Next, you need to find the index number of the Windows 10 edition you wish to use. To do this, execute the command below:
cd sources 
  • Then, type this command and press the enter key.
dism /Get-WimInfo /WimFile:install.esd

The result of the last command is shown below:

DISM /Online /Cleanup-Image /RestoreHealth - Deployment Image Servicing and Management

All the Windows 10 editions are listed with their index number. As the edition installed on my computer is Windows 10 Pro, I need to use the same edition for DISM repair. To see the index number, I need to scroll down a bit. Here are the details of Windows 10 Pro.

The index number I need is 6.

Before you proceed, you need to create a folder to extract your Install.WIM file to. To do this type the command below and press Enter.

mkdir d:\test

Important Tip

I created the folder in drive D because I know it exists. Replace drive D with a drive that exists on your computer.
  • Now it is time to extract Install.WIM to d:\test folder. To do this, run the command below:
dism /export-image /SourceImageFile:install.esd /SourceIndex:6 /DestinationImageFile:d:\test\install.wim /Compress:max /CheckIntegrity

Important Tips

This command must be run from the /Sources folder of the ISO mount drive. Note that it will take a while for the command to complete.

When the command completes, proceed to the next step.

DISM /Online /Cleanup-Image /RestoreHealth - Deployment Image Servicing and Management
  • Finally, to repair windows 10 using intall.wim, run the command below:

DISM /Online /Cleanup-Image /RestoreHealth /Source:d:\test\install.wim

When I ran the command it returned error 50: DISM does not support servicing Windows PE with the /Online option. If you receive this error message, find the resolution below this image.

How to Fix DISM Error 50

If you receive error 50 – “dism does not support servicing windows PE with the /online option”, resolve it with the steps below:

  • From the command prompt, type regedit and press enter. Registry editor opens.

Sponsored Content

  • Navigate to HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control. Right-click MiniNT key and delete it. On the delete confirmation, click Yes.

DISM /Online /Cleanup-Image /RestoreHealth - Deployment Image Servicing and Management

  • On the command prompt, type Exit and press Enter. Then Select Turn Off your PC.

Important Tip

When you reboot your computer and load command prompt, you do not need to Extract Install.WIM from Windows 10 ISO again.
  • When Command Prompt loads, change to the drive letter where your ISO is mounted. Also change to the \Sources directory. Then rerun the DISM command shown below:

DISM /Online /Cleanup-Image /RestoreHealth /Source:d:\test\install.wim 

If error 50 persists, get more information on how to resolve it from this guide – How to quickly fix DISM error 50 on Windows 10 (opens in a new window/tab). You may also read the DISM log shown in the error message.

How to Fix DISM.exe /Online /Cleanup-Image /Restorehealth Error 87

There are so many reasons why you may receive error 87 when you run the “DISM.exe /Online /Cleanup-Image /Restorehealth” command. Here are some of the causes of the error and how to fix them.

DISM.exe /Online /Cleanup-Image /Restorehealth Error 87: Solution 1

From my research, the top on the list is when you run the command without adding the required spaces in the switches. Below is the DISM command without spaces:


Run the command with spaces as shown below:

DISM.exe /Online /Cleanup-Image /Restorehealth

DISM.exe /Online /Cleanup-Image /Restorehealth Error 87: Solution 2

Another reason for error 87 could be pending updates.

The solution is to install all and any pending updates.

To check for and install any pending update, follow the steps below:

  • Right-click Windows logo on the left of your task bar [1]. Then click System [2].

Sponsored Content

DISM /Online /Cleanup-Image /RestoreHealth - Deployment Image Servicing and Management

  • When Settings loads, type updates in the search bar [1]. Then select Check for updates. Check the part labelled [3] for pending updates. If any click install.


DISM.exe is a very important Windows Command-line tool with many functionalities. I hope the content of this guide have been helpful.

If you have any question or comments, use the “Leave a Reply” form at the end of the guide. Alternatively, you could share your experience so other readers can benefit from it.

Other Helpful Guides

Additional Resources and References

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

By using this website you agree to accept our Privacy Policy and Terms & Conditions