Dealing with System file corruption in Windows is hard; trust me, I have been there. Sometimes the infamous SFC (System File Check) command won’t be able to fix this corruption. At this stage, you would think of reinstalling the Windows OS again. But it becomes time-consuming, especially if you have much software to set up afterward.
In this case, another useful tool comes in handy; It’s called the DISM tool. DISM stands for Deployment Image Servicing and Management. This helps to fix corrupt or broken window images without the need to reinstall from scratch. The advantage of this over the SFC command is that it can fix issues that the normal SFC /SCANNOW command cant fix.
But when used improperly, the DISM command could also fail. But it gives us an error code that we can use to identify the cause for the issue. One such error code that the DISM tools give out is the error code 87. So in this article, let’s see the reason for this issue and how you can resolve this issue.
Why Does DISM Error Code 87 Occur?
Microsoft defines that this error could happen if the parameters specified after the DISM command are incorrect. This simply means that you have typed in the command wrong, and you have to check your spacing and spelling correctly on the command. This error could also happen when you are typing in incompatible commands.
For instance, certain commands won’t work in previous versions of Windows like 7 or 8.1. So there is a chance of getting this error when trying to run commands that are not available for your version of windows.
Give SFC /SCANNOW a Try
As mentioned already, the DISM command will be mostly used when the normal SFC /SCANNOW command could not fix the issue. However, some people perform DISM command in advance. So if you are using this command prior to SFC, I would suggest you first perform the SFC command. Hopefully, your issue should be fixed with it.
- Press Windows Key + S and then look for Command Prompt or CMD to open as administrator.
- Type “sfc /scannow” and hit enter to start the process.
- Give a minimum of ten minutes to the tool to look for corrupted Windows system files.
- The inbuilt tool will seek out corrupted system files and fix them automatically.
The entire scanning process consumes less than ten minutes, but if there are corrupted files, then it will take twenty minutes. Do not close the Command Prompt or force shut down the machine because it is worth it.
Ways to Fix Error Code 87 for DISM commands
The best way of fixing this issue is to enter the correct command with the correct syntax in the command prompt or PowerShell. However, you can also use the help command to get all possible arguments to supply after the DISM command. Alternatively, you can refer below for the most used DISM commands.
Enter Correct DISM Line Commands
It is important to enter the DISM commands properly with spacing and slash with proper words
Press Windows Key and search for “CMD” or “Command Prompt” to open as administrator.
Scan Heath
This command can be used to scan for any corruption in the Windows image. To do so, you can use the following command on an administrative command prompt or Powershell. This is the most used command in the DISM tool.
- DISM.exe /Online /Cleanup-image /Scanhealth
Restore Health
After scanning for the heath, you have to use the following command to fix the issue if any issues found. Usually, this command is run after the ScanHealth command to fix the issues found in the first command.
- DISM.exe /Online /Cleanup-image /Restorehealth
Get Image Info
This command can help you to get information on the WIM image file. Usually, this command is useful for administrators who work with multiple images. Here’s the command to check information about the image file.
- Dism.exe /Get-ImageInfo /ImageFile:C:\test\offline\install.wim
Note: Here, you have to replace the text after /ImageFile with the location of your image file you want to check.
Mount Image
The following command can be used to check the contents of an image by mounting it to a specified location. Although you have to make sure that the location specified has been empty in order to mount the image to the location.
- Dism /Mount-Image /ImageFile:C:\test\images\myimage.wim /index:1 /MountDir:C:\test\offline
Note: Here as well, you have to change the /MountDirectory and /ImageFile as per your requirements.
Using Mounted Image to Fix Corrupt Windows image
In case you don’t have a reliable internet connection, then you can mount a Windows installation image using the above-mentioned command and then use that image as the source file to scan and fix system corruption. Here’s the command for that:
- Dism /Image:C:\offline /Cleanup-Image /RestoreHealth /Source:c:\test\mount\windows
Note: Here, replace the text after /Source with the location of your mounted image.
If you still cannot fix the issue, then you can try the DISM command to fix it. If that doesn’t work, you have to update your windows system from Windows update if any updates are available. But if you are already in the latest version then, you can only reset or reinstall the operating system.
Install Windows Update
Start > Settings > Select Update and Security > Click Windows Update tab > Click check for updates.
And if you find any updates, simply update the software.
Using the Correct version of DISM
I suggest you check the current version of your DISM and update it to the latest version just in case you are using an old one. If you are using the command line on the Windows 8 version of DISM and you expect it to run on the latest OS then you are wrong. Windows 10 version of DISM comes with Wofadk.sys filter driver there and users do not face any issues. Also, check out DISM Supported Platforms for more details.
Getting information on More command
If you want more information on each command or want information on a different command, you have to refer to the official document for this command. You can click here and refer to it. This documentation provides a deep overview of the usage application for the command with examples. This might come in handy if you are frequently working with Windows images.
Conclusion
So as you can see, fixing the error code 87 on Windows Deployment Image Servicing and Maintenance tool is very easy. Since there aren’t any technical aspects in this error code. It’s just a matter of typing in the correct command in the command prompt or Powershell environment. A
lso, have to make sure that you run the command as an administrator. Else it might give you some other errors. Although running as admin for personal computers is very easy. If you are using it in an enterprise environment, you might have to comply with the company’s policy to get admin rights and run such a command that requires elevation.
This post was last modified on May 31, 2021 8:02 pm