InfrastructureMicrosoft

Repair a Windows Image using DISM

Using DISM with the ScanHealth option

Use the DISM command with the /ScanHealth switch to scan the Windows image for any corruption. Unlike the /CheckHealth, the /ScanHealth switch can take up to 10 minutes to complete the process.

To run the command do the following:

  1. Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  2. Type the following command and press Enter:

    DISM /Online /Cleanup-Image /ScanHealth

Using DISM with the RestoreHearlh option

Use the DISM command with the /RestoreHealth switch to scan the Windows image for any corruption and to perform a repair automatically. Unlike the /ScanHealth switch, the /RestoreHealth switch can take up to 20 minutes to complete the process.

To run the command do the following:

  1. Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  2. Type the following command and press Enter:

    DISM /Online /Cleanup-Image /RestoreHealth

Note: While the running DISM using the /RestoreHealth or /ScanHealth, you will notice the process will seem stuck at 20% or 40%, but it’s normal behavior. After a few minutes, the operation will finish as expected.

When you run the command mentioned above, DISM will try to use Windows Update to replace the damaged files. However, if the problem has also extended to the Windows Update components, then you’ll need to specify a source containing the known good files to repair the image.

Using DISM with the RestoreHearlh and Source options

You can specify a new location for the known good files by using the /Source switch alongside /RestoreHealth.

Before you can use the repair commands, you will either need a copy of the install.wim file from another computer, a Windows 10 installation media, or the Windows 10 ISO file. It’s also very important that the source of the known good files matches the same version, edition, and language of the operating system you’re using.

You can download the ISO for Windows 10 using these instructions:

  1. Visit the Microsoft Windows 10 download page.
  2. Click the Download tool now button.
  3. Double-click the file to run the Media Creation Tool.
  4. Follow the on-screen directions to create an ISO file with the same version and edition of your current version of Windows 10.
  5. Once the process completes, double-click the file to mount the ISO, and note the drive letter as you’ll need it set the source path.

Note: If you come across any issues using the ISO using the Media Creation Tool, you can try downloading the Windows 10 installation files from the Microsoft’s Tech Bench Upgrade Program site.

Now you are ready to run the command to fix the Windows image:

  1. Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  2. Type the following command and press Enter:

    DISM /Online /Cleanup-Image /RestoreHealth /Source:repairSource\install.wim

    Or you can also run the following to limit the use of Windows Update:

    DISM /Online /Cleanup-Image /RestoreHealth /Source:repairSource\install.wim /LimitAccess

    Alternatively, you can also use following variant of the previous command to accomplish the same task:

    DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:repairSource\install.wim:1 /LimitAccess

Note: Remember to replace “repairSource” for the path to the source with known good files. For example, D:\Sources\install.wim.

The command will perform a Windows image repair using the known good files included within the install.wim file using the Windows 10 installation media, and without trying to use Windows Update as a source to download the required files for repair.

Using DISM with an install.ESD file

Alternatively, you can not only specify a source pointing to install.WIM, but you can also use an install.ESD file, which is an encrypted version of Windows image.

If you have upgraded to Windows 10 from a previous version of the operating system, the installation files may still stored on the C: drive, which means that you may just have a source of known good files.

To use the install.esd to repair the Windows image in your computer use the following steps:

  1. Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  2. Type the following command and press Enter:

    DISM /Online /Cleanup-Image /RestoreHealth /Source:C:\$Windows.~BT\Sources\Install.esd

    Or you can also run the following to limit the use of Windows Update:

    DISM /Online /Cleanup-Image /RestoreHealth /Source:C:\$Windows.~BT\Sources\Install.esd /LimitAccess

    Alternatively, you can also use following variant of the previous command to accomplish the same task:

    DISM /Online /Cleanup-Image /RestoreHealth /Source:esd:C:\$Windows.~BT\Sources\Install.esd:1 /LimitAccess

    Or if the install.esd is located on another drive use the following command:

    DISM /Online /Cleanup-Image /RestoreHealth /Source:repairSource\Install.esd

Note: Remember to replace “repairSource” for the path to the source with known good files. For example, D:\Sources\install.esd.

The Deployment Image Servicing and Management (DISM) utility will always create a log file at %windir%/Logs/CBS/CBS.log capturing any problems the command-line utility fixed or found.

Leave a Reply

Your email address will not be published. Required fields are marked *