DISM (Deployment Image Servicing and Management) is a powerful command-line tool to repair Windows images and fix system issues. If you’re having fatal problems and unable to run apps or even use your system properly then in such terrifying situations, the DISM command in Windows comes off very handy.
This article covers a full guide about the DISM command, how to use it, when to use it, and things you need to be careful about when using this tool.
Where To Use the DISM Command?
The DISM command is already built into Windows. You can run the command from either the Command Prompt or Windows Powershell.
When Should You Use It?
Although the DISM command is very useful, it’s not something you should just spam around. Keep it as a last resort when you have no other choice. If you’re facing problems such as:
- Getting Blue Screen of Death(BSOD)
- Application failures
- System crashing
- Windows features not working as they should
However, before running the DISM command, you should first try the SFC command. Don’t know about the SFC command? No worries. We’ll cover that as well.
System File Checker (SFC) is another built-in tool for Windows to repair missing and corrupted system files. It’s used to scan Windows and restore those files. You can troubleshoot many defections using this command.
Repair System Files With the SFC Command
You can use many options with the SFC command depending on what you want to do with the file(s). For example
- /scannow → Scans and repairs all protected operating system files
- /verifyonly → Only scans files and doesn’t repair them
- /scanfile=file → Scans and repairs only a specific file
For this tutorial, we’ll use the /scannow option.
First, you need to open the Command Prompt with administrator privilege. Go to search and start typing Command Prompt. Right-click on it and choose Run as administrator. You will get a prompt. Just select Yes so the Command Prompt starts running
Now type in the following command
It will start scanning your PC for any corrupted files. Usually, it takes a couple of minutes to scan everything so wait a bit.
If everything goes smoothly and it doesn’t find anything fishy, you’ll get the message “Windows Resource Protection did not find any integrity violations.”
If you get a “Windows Resource Protection found corrupt files but was unable to fix some of them” message instead, try using the command in Safe Mode.
Once this command repairs the corrupted files using local images, you can find the log files here.
If the SFC command failed to fix your issues, then it’s time to use the DISM command.
Just like the SFC command, the DISM command also has a few options. These are
You need to use these options in this particular order. We’ll show you how to use each option with the DISM command and what they do.
In order to use the DISM command, you will need to use the Command Prompt again. So following the same steps we showed above, open the Command Prompt with administrative privileges.
CheckHealth Option With The DISM Command
The CheckHealth option helps you find any defect with the Windows image. It doesn’t do any repairs though.
Run the following command to check if you need to make any fixes to the corrupted data.
DISM /Online /Cleanup-Image /CheckHealth
ScanHealth Option With The DISM Command
ScanHealth is a more advanced option. With ScanHealth, you can scan the Windows image for any corruption and check whether the image is repairable or not.
Run the following command in the Command Prompt.
DISM /Online /Cleanup-Image /ScanHealth
The full scanning will take some time. So wait for it to finish successfully.
DISM Command – RestoreHealth
Finally, you need to use the RestoreHealth option to repair any kinds of defects in the image. If you want to repair an online image using your own sources (Rather than Windows Update), run the following command
Dism /Online /Cleanup-Image /RestoreHealth
However, if you want to fix an offline image with a mounted image as a repair source, try this command;
Dism /Image:C:\offline /Cleanup-Image /RestoreHealth
If you don’t add any source, the default location of Features on Demand gets used. You can also add LimitAccess to the command so that the Windows Update is not used as the repair source. This is a sample command if you add source and /LimitAccess;
Dism /Online /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows /LimitAccess
If you’re a beginner and don’t have much knowledge about all these, we recommend you use the first command among the three.
It may take longer than the previous scans. It may even get stuck at 20% or 40%. Don’t panic as this is normal.
After the process is finished successfully, you’ll get the “The restore operation completed successfully.” message.
You can find the log files here;
Common Problems After /RestoreHealth is used
After using the above command, you may face some problems. Here we highlight two common problems you may face. If you face any other problems, let us know in the comments.
If you get this message, here’s how you can fix it.
- Step-1: Run the Command Prompt as administrator.
- Step-2: Type the command DISM /Online /Cleanup-Image /StartComponentCleanup and press ENTER.
- Step-3: Now type DISM /Online /Cleanup-Image /RestoreHealth and press ENTER.
- Step-4: Type this command sfc /scannow and press ENTER.
- Step-5: Restart your PC to see if your problem is solved or not
This error is caused by a corrupted system file. You can fix this with an in-place system upgrade. You may also want to check for hard disk issues and whether your PC is able to boot successfully.
This problem is mainly caused for two reasons.
- Not typing the command properly. For example, if someone forgets to add spaces and types DISM/Online/Cleanup-Image/RestoreHealth.
- If you forgot to run the Command Prompt as administrator.
If your system problems still persist after running the SFC and DISM commands, there are a few ways you can go.
If you have created a restore point previously, then try a System Restore. Chances are that your PC was in good health when you created the restore point.
Alternatively, you can take a backup and try reinstalling Windows again. You won’t lose files such as pictures or documents. However, you will have to reinstall all the programs.
Why Use the DISM Command
Using the DISM command, you can
- Check for damaged Windows features and system files.
- Identify and fix many Windows Operating System related bugs and issues (BSOD, application crash, system functions not working).
- Repair files that System File Checker or Windows Resource Protection found but failed to repair.
- Restore the system image so you can repair the Windows installation.
What is the DISM Command?
Deployment Image Servicing and Management (DISM) is a built-in command-line tool used for servicing and preparing Windows images.
You can use DISM to service a Windows image (.wim) or a virtual hard disk (.vhd or .vhdx).
How do I run the DISM command?
You can run through the Command Prompt or Windows Powershell. Here’s how you do it using the Command Prompt–
- Step-1: Go to search. You can use the Window Key + S keyboard shortcut.
- Step-2: Start typing Command Prompt in the search bar.
- Step-3: Rick-click on Command Prompt and press Run as administrator.
- Step-4: Type in the DISM command.
Should I run DISM or SFC first?
You should run SFC first. And then DISM if SFC fails to resolve the problem. SFC tool is used for checking missing system files and restoring them from the cache. On the other hand, the DISM command repairs Windows images by getting a replacement from the Windows servers.
What is a DISM cleanup image?
The /Cleanup-Image option is added with the DISM command when it’s run. This is used for fixing defects in Windows images. This is the syntax of how the /Cleanup-Image option is used:
Dism /Online /Cleanup-Image /RestoreHealth
In this tutorial, we’ve covered everything you need to know to use the DISM command so you can fix issues with your Windows PC. If we’ve missed any part or you’re facing any problem while fixing it, let us know in the comments.