Deployment Image Servicing and Management (DISM) is a command-line tool developed by Microsoft which 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 using the DISM commands. Some users, while using DISM /Apply-Image command are seeing error code 5 (ERROR_ACCESS_DENIED).
Generally, we see error code 5 while using the DISM /Apply-Image command on Windows 11/10 image where you have enabled Windows Subsystem for Linux (WSL) feature and installed the Ubuntu package. When you capture 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) while trying to use the DISM /Apply-Image command on Windows 11/10 image, the following solutions can help you fix it.
- Use the Windows 11/10 Image capture before installing the Ubuntu package
- Remove Ubuntu Package and Apply Image
Let’s get into the details of the two methods to fix the issue.
1] Use the Windows Image capture before installing the Ubuntu package
According to Microsoft, this error code 5 occurs while trying to apply images captured 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 Windows image captured might run into errors while applying the image. You need to uninstall the Ubuntu package, capture the image, and apply it. After that, you can download and install the Ubuntu package again.
2] Remove Ubuntu Package and Apply Image
If you have captured the Windows image before installing the Ubuntu package and trying to apply the image after installing the Ubuntu package, you may face 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 while applying an image using the DISM command.
These are the two methods you can use to fix error code 5 while applying Windows images with the DISM command.
How do I fix DISM errors?
If you face any DISM errors on your PC, you can disable antivirus temporarily, run an offline chkdsk scan, remove windows update, perform a system restore, etc. You have to implement fixes based on the actual concern and not in a generic way.
Related read: DISM Errors 87, 112, 11, 50, 3, 87,1726, 1392, 1393, 1910, etc.
What is DISM apply image?
DISM apply image command applies Windows image file to a specified partition. It also applies full flash update (.ffu) files to a specified partition. You can even apply the image to a virtual hard disk using this command but not support applying images from the virtual hard disk.
How do I create an image using DISM?
Creating an image using DISM is an easy process. First, you need to locate the data that you will create an image. Then, launch the command prompt as an administrator and use the DISM /Capture-Image command with the located path.