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 help in managing files such as drivers, updates, Language Packs (LPs), Local Experience packs (LXPs) and other components without booting the operating system image. To resolve similar issues, see: “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.
“The wim file needs to be remounted” error message 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 that even though the error message said “The wim file needs to be remounted”, 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>
For the already mounted WIM image, it’s a good practice to verify if the image has been correctly mounted. To do this, run the following command (modify this command 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 unmount 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 necessary when you plan to reuse the same WIM file to ensure that 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.
You can now proceed to remount the WIM file since no errors have been 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.