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?? 😉


8 Responses to “Convert WIM to VHD or VHDX”

  1. This fails on any image created with
    New-WindowsImage -CapturePath C:\VHDMount -Name MyImage -ImagePath C:\CapturedWIMs\2012r2.wim -Description “MyCustomeImage” -Verify

    If I comment out lines 4021-4024 and line 4038 and supply -Edition 1 then it works.

  2. Damien LEVEQUE said

    I need to use your script to convert a wim fil to vmdk but when I launch your script in command line or with the param –ShowUI I have no result:

    PS C:\> .\Convert-WindowsImage.ps1 New-WindowsImage -CapturePath C:\ -Name MyImage -ImagePath D:\2012r2.wim -Description “Win10Entreprise” -Verify
    PS C:\>
    PS C:\> .\Convert-WindowsImage.ps1 -ShowUI
    PS C:\>

    Can you help me ?

  3. Cat said

    Yeah, I’m with Damien LEVEQUE… NO GUI. This looked promising.. sadly there is too much crap out here. Clearly Brajesh Panda will not respond either.

  4. It is been quite sometime.Looks like it went thru few good number versions. So I can’t say. Have to look into the script.

  5. markinyik said

    it doesn’t work, when I run the ps script it doesnt show anything on both of my Win 8 and Win 10 PC
    PS C:\> .\Convert-WindowsImage.ps1 -ShowUI
    PS C:\>

    • Alex Nicastro said


      Please be aware you cant call the ps1 and use the -showui parameter. Once you highlight the whole script and run it you should be able to call the “Convert-WindowsImage” Function. So please try the following:

      1. Open the script in Powershell ISE
      2. Highlight the full script and hit Run this will load the convert-WindowsImage Function in memory.
      3. Once its in memory you can type Convert-WindowsImage -ShowUI

      That should bring up the User Interface… This took me actually a few minutes to figure out cuz of lack of coffee :).

      Hope it helps!

  6. Bruce said

    Convert-WindowsImage.ps1 has been updated to version 10 (June 2015), version 10 no longer supports the UI (GUI) option. Does anyone know where I can download the older version of Convert-WindowsImage.ps1 (version Version 6.3 QFE 7) which was the last version before version 10?

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: