While running the DISM tool to fix my Windows installation, I got “Error 87” and the command wouldn’t complete. I’m not sure what I did wrong my syntax seems correct. Can anyone explain why this happens and how to fix it step by step?
Error 87 is most often caused by incorrect syntax because the DISM command syntax is only slightly incorrect or avoided to executing the tool in the appropriate environment. Make sure you:
Open Command Prompt as an Administrator
Useful to use correct syntax as shown below.
DISM /Online /Cleanup-Image /RestoreHealth
Command does not contain any extra spaces or typos.
If it still would fail, then try to first fix sfc /scannow and then again retry DISM.
Open an elevated Command Prompt (right-click → Run as administrator).
Run System File Checker first:
sfc /scannow<br>
Run DISM with the correct spacing and params:
DISM /Online /Cleanup-Image /RestoreHealth<br>
(Important: use plain slashes and single spaces don’t paste “_” (long dashes) from web pages.)
If that returns Error 87 again, use a local source (mount a Windows ISO or USB). Suppose the ISO is mounted as D: and contains install.wim or install.esd:
# when install.wim is present:<br>DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:\sources\install.wim:1 /LimitAccess<br><br># or when install.esd is present:<br>DISM /Online /Cleanup-Image /RestoreHealth /Source:ESD:\sources\install.esd:1 /LimitAccess<br>
Additional checks if still failing:
Make sure you’re running the command as admin.
Ensure you didn’t mistype parameters (e.g., /RestoreHealth vs /restore-health).
If you’re in PowerShell, prefix DISM.exe (rarely needed) or run the command in CMD.
If using third-party DISM binaries or a mismatched architecture, use the built-in DISM in C:\Windows\System32.
That should fix it in most cases. If it still fails, tell me the exact command you ran and the full error line and I’ll help decode it.