Using DISM to repair windows from the install disc:
Assuming d: drive is where the cd/dvd is
launch cmd prompt as administrator
mkdir c:\mount
DISM.exe /mount-Image /ImageFile:d:\sources\install.wim /index:1 /mountdir:C:\mount\ /readonly
( server 2008, R2, without SP1 (because that is what I was trying to get installed) had to use DISM.exe /mount-wim /wimfile:d:\sources\install.wim /index:1 /mountdir:c:\mount\ /readonly )
make sure this results in:
Mounting image
[==========================100.0%==========================]
The operation completed successfully.then you can run
DISM.exe /Online /Cleanup-image /Restorehealth /Source:c:\mount\windows /LimitAccess
Not claiming to be an expert here but i’ve been dealing with the same issue.
Win pe is preinstall environment, since you are not running windows technically the os image is not online so /online wont work.
Use diskpart, then “list vol” to find what letter your OS partition is and what letter the installation media is then modify the command as such.
“DISM.exe /Image:*letter here*:\ /Cleanup-image /Restorehealth /Source:c:\mount\windows /LimitAccess”
To save having to mount the image beforehand change source to
“DISM.exe /Image:C:\ /Cleanup-image /Restorehealth /Source:WIM:*Install media letter*:\x64\sources\install.wim:1 /LimitAccess”
Depending on the install media you are using if it is only 64 bit install with no option for 32
“DISM.exe /Image:C:\ /Cleanup-image /Restorehealth /Source:WIM:*Install media letter*:\sources\install.wim:1 /LimitAccess”
Some installers use ESD instead of WIM so.
“DISM.exe /Image:C:\ /Cleanup-image /Restorehealth /Source:ESD:*Install media letter*:\x64\sources\install.ESD:1 /LimitAccess”
Still sometimes this fails and thats how i found myself here….
Anyone have any ideas as to why sometimes with a specified offline image /cleanup-image is not recognised as a command? or can someone please further correct my syntax if there are any errors? Thanks
I’m just placing this here, where I can find it again.
I’ll be doing this again, soon, and expect I’ll update here when I have a friendly reminder of what actually works. Funny thing, that, once something we do every 2 years or so works, we just move on. Til the next time…
update 8/5/2020. None of this worked for me on the Server 2008 R2 that I needed to get SP1 onto. But the “System Update Readiness” tool, surprisingly, DID fix the whole thing. Weird thing to note: you simply run the “update” (kb 947821) and it “fixes” stuff, logs it, etc. Here’s a link: https://support.microsoft.com/en-us/help/947821/fix-windows-update-errors-by-using-the-dism-or-system-update-readiness#!en-us%2Fhelp%2F947821%2Ffix-windows-update-errors-by-using-the-dism-or-system-update-readiness
It just looks like a standard KM updater, runs like one, but works more like DISM or other toosl when used for repair.