TechOnTip Weblog

Run book for Technocrats

Convert WIM to VHD or VHDX

Posted by Brajesh Panda on July 17, 2012

I hope you must have heard about WIM files. From the release of Vista these files are very much common in the OS installation process. WIM stands for Windows Imaging Format, means it is a file based disk image format. If you browse Vista, Win 7, Win 2k8 (R2) or Windows 2012 install media you will find boot.wim & Install.wim file. There are bunch of good articles about different benefits of WIM file like single instance image for multiple things, hardware independent etc. There are two tools which can be very usefull while working with wim images;

ImageX: To Create, Edit & Deploy WIM Images.

DISM: Deployment Image Service Management. Used to modify contents insides or retrieve what it contents.

So when we are installing Vista or later operating system, you don’t do file based installation like XP or older operating systems; where each file related to OS version get copied to hdd. Here OS installer just applies the WIM file to the disk. You may remember ghost images, it is somewhat same, apply the image to the target disk ;-) So technically we can apply the image file to a USB Drive or thumb drive & make it bootable. Only thing your hardware need to support to boot from that device.

Now days we are creating a lot virtual machines. Well we create golden virtual machine images & keep in our library (VHD/VMDK). And then we clone/deploy new virtual machines out of those images. But if we want to install brand new naked Windows virtual machines, we don’t need to go thru all the way thru installation process. We can convert the WIM file to a VHD file, it will create an out of factory syspreped VHD .

Let’s convert a Wim file to VHD;

You can download Convert-WindowsImage.ps1 script to convert the boot.wim file to a VHD/VHDX file. While you are downloading make sure you go thru the release notes which describes about each PowerShell parameters.

There used to be an old version called WIM2VHD.wsf script. But it has been re-written in PowerShell with VHDX support & lot of easy syntax.

If you don’t want to remember all PowerShell parameters, there is a GUI option;

  • Open PowerShell, change the directory to the folder where you downloaded above convert-windowsimage.ps1 script and run below command
  • .\Convert-WindowsImage.ps1 –ShowUI
  • It will open below UI image, populate/select necessary information & options & click make my vhd.
  • While it converting to VHD, you can see the process & progress in your PowerShell window. It took 3min to create my Windows 2012 VHDX file.
  • Then I used “new-vm -name Test2 -Path E:\VMStore\ -MemoryStartupBytes 512MB -SwitchName VM_Network -VHDPath e:\VMStore\test2\Win2k12DC.vhdx” to create my Windows 2012 VM
  • There is an “Unattended” Option; where you can input an unattended file so it will do necessary config in the target VM. We can club the conversion & VM creation to a single script. Bottom-line is we can do nice automation. Isn’t it awesome?? ;-)




About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 65 other followers

%d bloggers like this: