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

-

|

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.

Advertisement


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.

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.

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)

Advertisement


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.

Advertisement


  • Command Prompt loads.
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.
D:
  • Next, type Dir and press the Enter key.
DIR
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
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
Tip
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.

Advertisement


  • 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.
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:

Solution

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.

Solution
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].

Advertisement


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.

Conclusion

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

FEATURED POSTS

How to Share a Folder in Windows 10 (3 Methods)

Introduction This guide demos how to share folder in windows 10. It covers 3 methods. Options...

How to Map Network Drive in Windows 10 (5 Methods)

Introduction This guide demos 5 methods to Map Network Drive in Windows 10. Options to...
How to Install Windows 10 1909 Preview Build

How to Install Windows 10 19H2 Preview Build

Introduction If you are a member of Windows 10 Insider Program you can install Windows 10 19H2 Preview Build....

How to Sign in to Windows 10 with a Microsoft Account

Introduction When you installed Windows 10 you may have created and signed in with a local account. You can...
Disable IPv6 in Windows 10

How to Disable IPv6 in Windows 10 (3 Methods)

Introduction This guide demos 3 methods to disable IPv6 in Windows 10: Disable IPv6 from...

Advertisement

TRENDING POSTS

Remote Desktop Connection

Remote Desktop Connection an Internal Error Has Occurred [Fixed]

Introduction I recently received the error message "Remote Desktop Connection an Internal Error Has Occurred". It was strange because...

Find My Samsung: Register and Use Samsung Find my Mobile

Introduction Ever wondered how you could find your Samsung phone if you lost it? Find my Samsung or Samsung...
What is the Difference Between PowerShell and CMD?

Windows Powershell vs CMD: Differences and Similarities

Introduction This short guide compares Windows PowerShell vs CMD (Windows command prompt). I will cover the history and nature...
Spotify No Longer Supports this Version of Microsoft Edge

Spotify No Longer Supports this Version of Microsoft Edge [Fixed]

Introduction When you open Spotify web player on Microsoft Edge, you may receive the error message "Spotify No Longer...
Windows 10 Won't Boot

Windows 10 Won’t Boot With Black Screen? 3 Ways to Fix It

Why Won't Windows 10 Boot Up? If your Windows 10 stops with a black screen, the first question in...

Advertisement

BEST OF ITECHGUIDES

Install Active Directory Role in Server 2016 and Promote to DC

How to Install Active Directory Role in Server 2016 and Promote to DC

Introduction This guide demos how to install Active Directory in Server 2016. It also covers how to promote the...
Steps to Fix "Windows has Detected an IP Address Conflict"

How to Fix “Windows has Detected an IP Address Conflict”

Introduction "Windows has Detected an IP Address Conflict" means that two computers on the network have the same IP...

How to Fix “BootMgr is Missing” Error in Windows 10

Introduction If you receive Fix "BootMgr is missing" Error in Windows 10, the default response is panic! But you...

Powershell For Loop Explained: Syntax and Examples

Introduction "Powershell For Loop" (or Statement) is a construct that is used to run a command in a...
how to delete spotify account

How to Delete Your Spotify Account

Introduction There may be so many reasons you may want to delete your Spotify account. May be you prefer...

RECENT POSTS

How to Enable Hyper-V in Windows 10 (3 Methods)

How to Enable Hyper-V in Windows 10 (3 Methods)

Introduction This guide demos 3 methods to enable Hyper-V in Windows 10. To install Hyper-V...
RSAT Tools in Windows 10 Explained: Plus How to Install RSAT

RSAT Tools in Windows 10 Explained: Plus How to Install RSAT

Introduction Starting from October 2018 (1809) update, RSAT Tools became part of Windows 10. From this version of Windows...

How to Enable RSAT for Active Directory in Windows 10 (3 Methods)

Introduction This guide demos 3 methods to enable Active Directory in Windows 10. It is not exactly enabling "Active...
How to Install Windows 10 1909 Preview Build

How to Install Windows 10 1909 (19H2) Preview Build

Introduction Windows 10 1909 Preview is available for Windows Insiders. Made available early September, 2019 you have to be...
How to Install RSAT in Windows 10 (3 Methods)

How to Install RSAT in Windows 10 (3 Methods)

Introduction This guide demos how to Install RSAT in Windows 10. Starting with Windows 10...

How to Share a Folder in Windows 10 (3 Methods)

Introduction This guide demos how to share folder in windows 10. It covers 3 methods. Options...
Configure Map Network Drive with Group Policy

Map Network Drive in Windows 10 with Group Policy

Introduction This guide demos how to map network drive with group policy. This guide is...

How to Map Network Drive in Windows 10 (5 Methods)

Introduction This guide demos 5 methods to Map Network Drive in Windows 10. Options to...
How to Download Windows 10 ISO with Media Creation Tool

How to Download Windows 10 ISO with Media Creation Tool

Introduction This guide demos the steps to download Windows 10 ISO. You can download Windows 10 ISO with Media...

How to Install Windows 10 from Network Boot (Via WDS Server)

Introduction This guide demos how to install Windows 10 from network boot. The steps discussed in...

Advertisement

MUST READ

NTFS Permissions with Share Permissions

NTFS Permissions with Share Permissions Compared

Introduction Combing NTFS permissions with share Permissions increases folder security within a network. Every Windows Administrator should have a...
Windows 10 not booting after update

How to Fix Windows 10 Boot Problem After Windows Update

If you experience Windows 10 not booting after an update, it is likely that the update corrupted the boot files.
Latest Windows 10 Update

How to Install Latest Windows 10 Update (May 2019 Update 1903)

Introduction The latest Windows 10 update is 1903. It was released May 2019. Microsoft strongly recommend updating to the...
Amazon Orders

Amazon Orders: Everything You Need to Know

Introduction Ever wondered whether you can hide some of your Amazon orders? Yes, you can! But how do you...
dns server not responding featured image

“DNS Server Not Responding” Error [Fixed]

What Could Cause "DNS Server Not Responding" Error Message? The error messages "DNS Server Not Responding" or "DNS...

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