Apr 6, 2016

How to use DISM command-line utility to repair a Windows 10 image


In this Windows 10 guide, we'll walk you through the steps to use the command-line DISM to help you get your system back to a healthy state.



Windows 10 includes a nifty command-line utility known as Deployment Image Servicing and Management (DISM). It has been around since Windows Vista SP1, and now comes installed by default on Windows 10 and Windows 8.1.

If your Windows 10 PC slowing you down, and the SFC utility is unable to fix the problem? Then use DISM to repair the Windows image to enable SFC to do its job.

The utility can be used to repair and prepare Windows images, including the Windows Recovery Environment, Windows Setup, and Windows PE. Also, DISM can be used to fix the recovery image within an installation of the operating system and even to service a virtual hard disk.


If your computer begins to feel buggy and you notice problems during boot, you can use the System File Checker (SFC) command-line utility to check the integrity and replace any corrupted or missing protected system files with a known good version.

When SFC is unable to fix the problem, chances are the utility was unable to get the necessary files from the Windows image, which might have become broken. In this situation, you can use DISM to repair the Windows image (.wim), which then it will allow you to use the System File Checker to fix any issue with your Windows 10 installation.

 

Before you begin

It's important to note that you'll be making changes to your computer, as such it's recommended to do a full backup or create a system restore point in case things go wrong, and you need to rollback the changes.

 

How to run DISM commands to fix Windows 10

There are three main options you can use with DISM to repair the Windows image on your computer, including CheckHealth, ScanHealth, and RestoreHealh -- and you want to use them in this order.

 

Using DISM with the CheckHealth option

Use the DISM command with the /CheckHealth switch to verify whether any corruption has been detected. This command can only be used to see if corruption exists, but it doesn't perform any repairs.

To run the command do the following:
  • Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  • Type the following command and press Enter: 
DISM /Online /Cleanup-Image /CheckHealth


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:
  • Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  • 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:
  • Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  • 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.

 

How to repair Windows 10 problems

The instructions you've learned thus far are to repair the Windows image. Now you can use the Windows image to fix the problems in your Windows 10 installation using the System File Checker (SFC) utility.


  1. Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  2. In the Command Prompt type the following command and press Enter:
    sfc /scannow
Quick Tip: It could take up to three tries for SFC to fix the issue.

This SFC command will scan and repair system files on Windows 10, but now with access to replace missing or corrupted files using known good files from the Windows image.

Post a Comment

 
TECH SUPPORT © 2012 - Designed by INFOSBIRD