Converting a VHD/VHDX to a Wim File

Warning
This blog post is included for archival purposes and may contain outdated information. While it provides historical insights, we strongly recommend that you double-check the details before relying on any of the information outlined here.

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

 

About Author

Christian Saborio

Christian is a seasoned computer engineer with a rich career spanning collaborations with industry leaders such as Artinsoft (now Mobilize.net), Microsoft, HP, and Intel. As a technical evangelist and trainer, Christian honed his expertise in Costa Rica and Seattle, delivering impactful solutions and sharing his knowledge.

Now based in Sydney, Australia, Christian channels his passion into web development, leading a talented team to tackle diverse projects with innovation and precision. His commitment to crafting exceptional digital experiences reflects his deep-rooted enthusiasm for technology and problem-solving.

Comments

  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”?!

    • Christian Saborio says:

      Thank you Henrik, you are absolutely correct. The post has been corrected to reflect this.

Comments are closed

Thank you for your interest. Please fill out this form to provide us with your contact information. We'll get back to you as soon as possible.