The three DISM commands you should know to fix your Windows system images

Sometimes system file damage can also break Windows Update, preventing DISM from downloading replacement files. When this happens, you can use an official Windows installation media to supply DISM with the necessary repair files. You can download a Windows ISO from Microsoft's official download page. Once downloaded, right click the ISO file and select mount. Windows will create a virtual drive for the ISO, assign it a drive letter and make its contents available.

Next, you'll need to check the Windows editions available in the downloaded installation media. You can do that by launching the command prompt as an administrator and running the DISM /Get-ImageInfo /ImageFile:D:sourcesinstall.wim command. This command lists the Windows editions available on the installation media along with their index numbers. Make a note of the index number corresponding to your installed edition before proceeding to the next step.

Now, run the DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:sourcesinstall.wim:6 /LimitAccess command. Replace D: with the drive letter assigned to the mounted Windows ISO and 6 with the index number corresponding to your Windows edition. This directs DISM to use the installation media as its repair source instead of downloading files from Windows Update.

Once DISM completes its operation, run the sfc /scannow command to repair 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.