DISM Examples

I seem to always have to go hunting for the syntax to run DISM /restorehealth, so here are a few quick examples.

The basic command for online cleanup:

dism /Online /Cleanup-Image /RestoreHealth

If it complains about not finding sources, you can mount the installation ISO (right click, Mount), then use it as a drive. Let’s assume it’s a .wim file on drive F.

First we need to determine which index of the WIM file contains the OS you are repairing:

dism /Get-WimInfo /WimFile:F:\sources\install.wim

DISM 1

In this case, we want index 2, Server 2016 with a GUI (“Desktop Experience”). Specify that index after the last colon in the /Source parameter:

dism /Online /Cleanup-Image /RestoreHealth /Source:wim:F:\sources\install.wim:2

DISM 2

Leave a Reply

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

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.