A Windows system functions using critical system files that enable programs to operate, apply updates, and handle routine operations. Damage or loss of these files can lead to malfunctions, including errors, broken features, crashes, or irregular performance.
Occasionally, a simple restart or basic troubleshooting won’t fix corrupted system files. In these situations, Windows offers a built-in tool called Deployment Image Servicing and Management (DISM) to address the issue.
DISM is a command line tool that can scan Windows system images for corrupt system files and attempt repairs. There are three useful DISM commands that achieve this purpose: CheckHealth, ScanHealth, and RestoreHealth.
Understanding DISM Commands
These commands share a common structure starting with DISM /Online /Cleanup-Image. The /Online parameter targets the active Windows installation, while /Cleanup-Image executes recovery tasks on that installation.
The initial command, DISM /Online /Cleanup-Image /CheckHealth, verifies if Windows has identified corrupted files and assesses their reparability. This quick check is the recommended starting point for diagnosing file corruption.
Following that, DISM /Online /Cleanup-Image /ScanHealth conducts a thorough scan of system files and reports any issues. While this process may take several minutes, it provides an up-to-date assessment of the component store‘s integrity.
Repairing System Files
The DISM /Online /Cleanup-Image /RestoreHealth command scans for corruption and attempts automatic repairs. By default, it uses Windows Update to fetch the necessary files for fixing the component store.
Sometimes system file damage can also break Windows Update, preventing DISM from downloading replacement files. When this happens, an official Windows installation media can be used to supply DISM with the necessary repair files.
A Windows ISO can be downloaded from Microsoft’s official download page. Once downloaded, the ISO file can be mounted, and Windows will create a virtual drive for it, assigning a drive letter and making its contents available.
Then, the DISM /Get-ImageInfo /ImageFile:D:\sources\install.wim command can be run to list the Windows editions available on the installation media along with their index numbers. The index number corresponding to the installed edition should be noted before proceeding to the next step.
Next, the DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:\sources\install.wim:6 /LimitAccess command can be run, replacing D: with the drive letter assigned to the mounted Windows ISO and 6 with the index number corresponding to the Windows edition.
This instructs DISM to use the installation media for repairs instead of Windows Update. After DISM finishes, running sfc /scannow can further address any remaining damaged or missing system files.
Microsoft recommends running the DISM repair utility before System File Checker (SFC) because DISM repairs the Windows component store, which SFC relies on to replace corrupted system files. As DISM and SFC work together, they can help restore a damaged Windows installation to a healthy state.
