A WIM file is saved in a file-based imaging format and this was first introduced in Windows Vista. A WIM file enables you to deploy a single disk image to numerous devices. WIM files are used to manage files such as drivers, updates, Language Packs (LPs), Local Experience packs (LXPs) and other components without booting the operating system image. For a similar issue, see how to resolve “Error 740: Elevated permissions are required to run DISM“. Also see, You require permission from trustedinstaller: How to delete or rename files protected by Trusted Installer and Folder Access Denied, you require permission from SYSTEM: Unable to delete old windows folder. This error is a result of the corruption of the “wim file” in my case. In this guide, we will look at how you un-mount and cleanup a Wim Image file using the DISM tool.
I found out in my case, remounting did not help in resolving my issue. You could try this and if this does not work for you, simply move to the steps discussed below. This command simply help recover an orphaned image mount directory.
dism /remount-wim /MountDir:<mountDir>
On the already mounted Wim image, it makes sense to see if the image is correctly mounted. To do this, run the following command (this command can be modified to support your file structure/path). Run the command below to get the mounted WIM information.
Therefore, to resolve this issue, the steps below helped me. First, we will have to unmount using one of the commands below that suits your environment.
Force umount by discarding the wim file
dism /unmount-Wim /MountDir: /Discard dism /Unmount-Wim /MountDir:C:\path-to-the-mount\Mount-A /discard
When this step is complete, the next thing to do is to clean the WIM file.
- This is only needed when you intend to use the same wim file to ensure all errors are cleared.
- If there are changes in the WIM file, please delete it and copy it again from the source.
Now the WIM file size has not changed, there is no need to get (extract) a new wim file from the source (ISO, and DVD). Just proceed with the steps below to clean the wim file.
C:\windows\system32>dism /Cleanup-Wim ------------------------------------- Deployment Image Servicing and Management tool Version: Scanning drive C for stale files Scanning drive G for stale files The operation completed successfully.
Now you can proceed to mount the WIM file again as there are no errors reported and the file size remains unchanged. To do this, use the command below.
dism /Mount-Wim /WimFile:<Path>image.wim /Index:<indexnumber> /MountDir:<mountDir>
Now, you can proceed to add or remove packages without any error. I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.