Converting a VHD/VHDX to a Wim File

Converting a VHD/VHDX to a Wim File

While getting ready for an event that will be staged completely with WDS, I ran into issues capturing a VHD file to a WIM file using WDS.  My guess is that the old Mac Mini I’m using is not keeping up so I needed a way to get that VHD to convert to a WIM file.
I found this thread that explains a couple of methods to do this, so here are my results on the first one.

Using PowerShell to Convert to WIM

The process is very simple, mount the VHD to a directory and then use the New-WindowsImage commandlet do its job.

Create the directory to where you would like to have the image mounted before you run the following command:

Mount-WindowsImage -ImagePath “C:\VMs\VHDs\Test WDS.vhdx” -Path C:\VHDMount -Index 1

Once that command runs, you’ll see the contents on c:\VHDMount:

Next, create a directory where you would like to store the Wim file (in my case C:\CapturedWims\) and run the following:

New-WindowsImage -CapturePath C:\VHDMount -Name Win8Test -ImagePath C:\CapturedWims\Win8.wim -Description “Windows 8 Clean” -Verify

Finally, unmount the image discarding any changes as none should have been made to the master VHD:

Dismount-WindowsImage -Path C:\VHDMount -Discard


2 responses to “Converting a VHD/VHDX to a Wim File”

  1. Henrik Mai says:

    there is a misstake in the last two lines.
    You say “…unmount the image discarding any changes” and the commandline locks like “-save”. That doesn´t match!
    I think the option must bee “-discard”?!

Leave a Reply

Your email address will not be published. Required fields are marked *