The Deployment Image Servicing and Management (DISM) command is a powerful command-line tool used to repair a corrupted Windows system image, manage drivers, and update Windows features. To use DISM for system repair, open Command Prompt as an administrator and run dism /online /cleanup-image /restorehealth. This process scans the Windows image for corruption and automatically replaces damaged files using Windows Update as the source.
What You'll Need
- A computer running Windows 8, 10, or 11.
- An account with Administrator privileges.
- A stable internet connection (required for the /RestoreHealth command to download replacement files from Windows Update).
- Optional: A Windows installation ISO or USB drive if the computer is offline or Windows Update is failing.
Step-by-Step
- Open Command Prompt as Administrator: Click the Start button and type "cmd". In the search results, right-click on "Command Prompt" and select "Run as administrator". If a User Account Control (UAC) prompt appears, click Yes. This is critical because DISM modifies system-level files that are protected from standard user accounts.
- Verify System Corruption (CheckHealth): Before attempting a repair, check if the system has already flagged any corruption. Type the following command and press Enter:
dism /online /cleanup-image /checkhealth
This command is a quick check that does not perform a deep scan. It simply looks at the existing logs to see if the image is flagged as corrupted. It will either tell you the image is healthy or that corruption was detected. - Perform a Deep Scan (ScanHealth): If the previous step was inconclusive or you suspect deeper issues, run a full scan. Type the following command and press Enter:
dism /online /cleanup-image /scanhealth
This process takes longer as it examines every component of the system image. It will report whether the image is repairable or if the corruption is too severe for the standard online repair tool. - Execute the Repair (RestoreHealth): If corruption is found, run the repair command. Type the following and press Enter:
dism /online /cleanup-image /restorehealth
This is the most important step. DISM will now compare your system files against the official Windows image. If it finds a discrepancy or a corrupted file, it will download a fresh, healthy copy from the Windows Update servers and replace the damaged version. This process can take anywhere from 5 to 30 minutes depending on the extent of the damage and your internet speed. - Run SFC to Finish the Job: DISM repairs the underlying system image (the source files), but it does not always fix the active files currently being used by Windows. To ensure the active system files are also corrected, run the System File Checker. Type the following and press Enter:
sfc /scannow
SFC uses the healthy image that DISM just repaired to fix any remaining corrupted files in the active Windows directory. - Restart Your Computer: Once SFC reports that it has successfully repaired files, restart your PC to ensure all changes are applied and system stability is restored.
Common Mistakes
- Forgetting Administrator Rights: The most common error is running Command Prompt as a standard user. If you see an "Error: 740" or "Access Denied," it means you are not in an elevated prompt. You must right-click and select "Run as administrator."
- Typing Errors: DISM is very sensitive to syntax. Ensure there is a space before every forward slash (/). For example,
dism/onlinewill fail; it must bedism /online. - Interrupting the Process: Closing the Command Prompt window or shutting down the PC while DISM is at 20% or 80% can lead to further system instability. Always let the process reach 100% and return to the command prompt cursor.
- Confusing DISM with SFC: Users often run
sfc /scannowfirst. While this is common, if the system image itself is corrupted, SFC will fail because it has no "healthy" source to copy from. Always run DISM/restorehealthbefore SFC for the best results.
Tips
- Use a Notepad Template: If you find yourself performing these repairs often on multiple machines, copy the three main commands (CheckHealth, ScanHealth, RestoreHealth) into a Notepad file so you can copy and paste them to avoid typos.
- Monitor the Log: If you are a power user and want to see exactly what was repaired, DISM creates a detailed log file located at
C:\Windows\Logs\CBS\CBS.log. You can open this with a text editor to see which specific files were corrupted. - Combine with Safe Mode: If the system is so unstable that the Command Prompt crashes during the scan, try booting into Safe Mode with Networking. This disables third-party drivers and services that might be interfering with the repair process.
- Check Your Internet: Since
/restorehealthrelies on Windows Update, ensure your firewall isn't blocking the connection. If you are on a corporate network, a proxy might prevent DISM from reaching the Microsoft servers.
Troubleshooting
If the /restorehealth command fails with an error such as "Source files could not be found," it means DISM cannot reach Windows Update or the local recovery image is also corrupted. In this case, you must provide a manual source.
Using an External Source:
- Download the Windows ISO file that matches your exact version and build of Windows.
- Right-click the ISO and select "Mount." This will assign it a drive letter (e.g., Drive D:).
- Identify the location of the
install.wimorinstall.esdfile, usually found in thesourcesfolder of the mounted drive. - Run the following modified command (replace D: with your actual drive letter):
dism /online /cleanup-image /restorehealth /source:WIM:D:\sources\install.wim:1 /limitaccess
The/limitaccessflag tells Windows NOT to use Windows Update and only use the provided local source.
If the command still fails, ensure that the version of the ISO matches your installed version of Windows (e.g., do not use a Windows 10 Home ISO to repair a Windows 10 Pro installation). If all else fails, a "Reset this PC" operation via Settings > System > Recovery may be necessary, though this is a more drastic step that can affect installed applications.
Frequently Asked Questions
Does DISM delete my personal files?
No. DISM only repairs system image files and Windows components. It does not touch your documents, photos, or personal data.
How long does the DISM process usually take?
Depending on the speed of your hard drive (SSD vs HDD) and your internet connection, the process typically takes between 10 and 30 minutes. It is normal for the progress bar to seem "stuck" at certain percentages for several minutes.
What is the difference between DISM and SFC?
SFC (System File Checker) repairs the active files used by the OS. DISM (Deployment Image Servicing and Management) repairs the system imageāthe "master copy" that SFC uses to perform its repairs. If the master copy is broken, SFC cannot work, which is why DISM is used first.
Can I run DISM on a PC that won't boot into Windows?
Yes, but it requires a different approach. You must boot from a Windows Installation USB, open the Command Prompt from the repair menu, and use the /image flag instead of /online to specify the path to the Windows installation on the hard drive.
Is it safe to run DISM on a healthy computer?
Yes, it is completely safe. Running /checkhealth or /scanhealth will not change anything on your system; it only reports the status. Running /restorehealth on a healthy system will simply verify that everything is correct and make no changes.