Deployment Image Servicing and Management (DISM) is a command-line tool developed by Microsoft that can be used to service Windows images. DISM image management commands can get information about Windows Image (.wim) files, Full-flash Utility (FFU) files, or virtual hard disks. You can capture, split, and manage .wim files with DISM commands. Some users, while using DISM Command/Apply Image they are watching error code 5 (ERROR_ACCESS_DENIED).
Generally, we see error code 5 while using the DISM /Apply Image Command in the Windows 11/10 image where you have enabled the Windows Subsystem for Linux (WSL) feature and installed the Ubuntu package. When you capture a Windows 11/10 image from your PC using the DISM / Capture Image command and then try to apply the captured Windows image using DISM /Apply Image command, you see Error code 5 (ERROR_ACCESS_DENIED).
Fix DISM /Apply-Image command fails with error code 5
If you see error code 5 (ERROR_ACCESS_DENIED) when trying to use the DISM /Apply-Image command on the Windows 11/10 image, the following solutions may help you fix it.
- Use Windows 11/10 image capture before installing Ubuntu package
- Remove Ubuntu package and apply image
Let us go into the details of the two methods to fix the problem.
1]Use Windows Image Capture before installing the Ubuntu package
According to Microsoft, this error code 5 occurs when trying to apply captured images after installing the Ubuntu package. We must eliminate that possibility by capturing the image before installing the Ubuntu package. If you have already installed the Ubuntu package, the captured Windows image might fail to apply the image. You need to uninstall the Ubuntu package, grab the image and apply it. After that, you can download and install the Ubuntu package again.
2]Remove the Ubuntu package and apply the image
If you captured the Windows image before installing the Ubuntu package and tried to apply the image after installing the Ubuntu package, you may encounter this error as the Ubuntu package interferes with the process. You have to apply it before installing Ubuntu. This is the only way to avoid error code 5 when applying an image using the DISM command.
These are the two methods you can use to fix error code 5 when applying Windows images using the DISM command.
How do I fix DISM errors?
If you are facing any DISM errors on your PC, you can temporarily disable antivirus, run offline chkdsk scan, remove Windows update, perform system restore, etc. You should implement fixes based on the actual problem and not generically.
Related reading: DISM errors 87, 112, 11, 50, 3, 87,1726, 1392, 1393, 1910, etc.
What is the DISM Application Image?
The DISM apply image command applies the Windows image file to a specific partition. It also applies full flash update (.ffu) files to a specific partition. You can even apply the image to a virtual hard drive with this command, but applying images from the virtual hard drive is not supported.
How do I create an image using DISM?
Creating an image using DISM is an easy process. First, you need to locate the data with which you will create an image. Then start the command prompt as administrator and use the DISM /Capture-Image command with the located path.