Unmount and Clean up a Wim Image using DISM
Unmount and Clean up a Wim Image using Deployment Image Servicing and Management (DISM)
DISM provides you an option to load Wim images onto your local drive and the service it offline. You can either add/remove a driver, enable/disable features, perform other customizations..without even installing them on a physical box. Now when you have mounted a Wim image, its really necessary to check if the image is mounted correctly. you can do that by running the command, dism /get-MountedWiminfo.
Check the Status. If the Status is OK, then everything is good. If the Status is anything else., for eg: Needs Remount, Status Un-available, Invalid.. etc.. Its an indication that, you gotta’ remount (repair) the image. In this article, you will know how to Unmount, clean and remount a Wim image using the DISM tool.
The screenshot above shows the mounted image status as “Invalid”. This means that the mount point is corrupted and there may be resources associated with the mounted image that has been abandoned. The cleanup command does not unmount a mounted image, nor does it delete images that can be recovered using the remount command. You can use the cleanup command to delete these abandoned resources. You can cleanup using the command syntax: dism /cleanup-wim
If the mounted image status shows as “Need-Remount”, you can run the remount command to recover the orphaned mount path.
Re-Mounting a Wim Image
When you have an issue with the mounted images as seen above, you will need have a need to re-mount the images which are mounted. This command will recover an orphaned Wim mount directory. You can re-mount using the command syntax. dism /remount-wim /MountDir:<mountDir>
Un-Mounting a Wim Image
Once you are done with Servicing the Wim Image, you can unmount the image from your machine. Most of the IT Pros have asked this, what if they have forgot to save the changes, before they unmount. Thats how the DISM team has added this switch either to commit or discard the changes. dism /unmount-Wim /MountDir:<mountDir> /commit
Changes to WIM files are not “committed” until you do so specifically. You have three choices:
Unmount the image using the /Commit option (to save changes)
Use the /Commit option without unmounting (this keeps the image open so you can make more changes).
Unmount the image and use the /Discard option. In this case the image in the WIM file will be unchanged. This is used primarily as a manual “undo” of your changes.
Cleaning up all Mounted Wim Images
This operation will search for all the staleg up all Mounted Wim Images
or corrupted files in your machine and clean it up! – dism /cleanup-wim
The /Cleanup-Wim command is only used if there is any issue with the mount points, that means when any of the mounted images are shown as in the “Invalid” state. You can run the cleanup command to delete these abandoned resources at the corrupted mount points. There is no need to run the cleanup command every time when you are done with servicing the mounted images, but only when you run the /get-mountedwiminfo command and found that there are some mounted images showing the “Invalid” status. (as shown in the first screenshot in this article)
Since cleanup command only needs to be run when the /get-mountedwiminfo shows any mounted images in “Invalid” state, and the cleanup command does not unmount a mounted image, nor does it delete images that can be recovered using the remount command, running the /get-mountedwiminfo command after running the /cleanup-wim command usually still shows the mounted images with status no longer in the “Invalid” state instead of no mounted images as shown in the snapshot above. Note that is very rare that a mounted images will be in the “Invalid” state, since it is rare that a mount point will become corrupted unless something weird has happened to the host system!
Category: Uncategorized