WIM stands for Windows Imaging Format. It is a file based disk image format, first developed by Microsoft to deploy Windows Vista. Later on, the disk image format is used for running other later versions of Windows as well. There is a plethora of disk image system in Windows, some of which are sector based, while some are file based. Windows Imaging Format falls in the file format category. The main advantage of a file-based disk image format is that it is not dependent on hardware constraints. Moreover, a single instance storage of file is referred multiple times in the file system tree, which resolves many issues related to opening and closing, reading and writing of files. Many a times, a Windows Imaging Format crashes. In that case, you can discard or unmount the WIM. There are two methods of doing it, one via Windows PowerShell and another method is by Windows Image method.
Also Read: What Is Deployment Image Servicing And Management (DISM)?
Steps To Unmount Or Discard Failed WIM Using Windows Image Method in Windows PowerShell
Check out the terms which will appear in the following commands.
- Path: The term path specifies where the mounted Windows image is located in your OS.
- Append: The exisiting .wim file is added the Windows image when you run the dismount command, in place of overwriting the existing image.
- CheckIntegrity parameter detects and checks for .wim file corruption.
Discard and Dismount
Dismount-WindowsImage -Path <String> [-Discard] [-LogPath <String>] [-ScratchDirectory <String>] [-LogLevel <LogLevel>] [<CommonParameters>]
Save And Dismount
Dismount-WindowsImage -Path <String> [-Save] [-CheckIntegrity] [-Append] [-LogPath <String>] [-ScratchDirectory <String>] [-LogLevel <LogLevel>] [<CommonParameters>]
Check the following example
Dismount-WindowsImage -Path "c:\offline" -Discard
Steps To Unmount Or Discard Failed WIM Using Registry Path Method In Windows PowerShell
The PowerShell command line has been developed by Adam Gross, a MVP. All your need to do is open you Windows Search bar. Type Windows PowerShell. From the search results, right click on Windows PowerShell and click on Run As Administrator.
Next, copy and paste the following cmdlet and hit Enter. This will essentially find out locations of the mounted images, check their discard status and unmount the failed ones in bulk, one after another. Each unmount takes approximately 25 seconds.
Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\WIMMount\Mounted Images" | Get-ItemProperty | Select -ExpandProperty "Mount Path" | ForEach-Object {Dismount-WindowsImage -Path $_ -Discard}
That’s all!