How do I convert a vhd to a wim file?
Solution 1:
Absolutely, let's post a prim and proper answer for Google. This is a simple 2 command Powershell execution, using the dism
module. The dism can be copied to earlier versions of Windows, provided you have the appropriate version of the windows management framework.
First, mount the vhd using
Mount-WindowsImage -ImagePath C:\VHDs\BigHomies.vhdx -Path C:\VHDMount -Index 1
Then, capture it into a wim with
New-WindowsImage -CapturePath C:\VHDMount -Name Win7Image -ImagePath C:\CapturedWIMs\Win7.wim -Description "Yet another Windows 7 Image" -Verify
And let it do it's thing. When you are done you can unmount the vhd and discard any changes using:
Dismount-WindowsImage -Path C:\VHDMount -Discard
Solution 2:
If, for some reason, Powershell is not an option - do not despair!
In Windows 7 or later, you can mount the .vhd via disk management (link)
Once it is mounted, you can use imagex.exe to capture the .wim (technet link)