Table of Contents

Using the Diskimage-Builder PowerShell script

This page thoroughly documents the use of this PowerShell script to obtain valid vdh/vhdx/qcow2 Windows disks from an installation .iso image.

Prerequisites:

Start a PowerShell session from :

> start powershell

Downloading and installing dependencies:

Download and install :

PS> (New-Object System.Net.WebClient).DownloadFile("https://msysgit.googlecode.com/files/Git-1.9.0-preview20140217.exe", "$HOME\Git-1.9.0-preview20140217.exe")
PS> cmd.exe /C call $HOME\Git-1.9.0-preview20140217.exe /SILENT

For , download and install the latest tools(as of the making of this article, build date 08.01.2014):

PS> (New-Object System.Net.WebClient).DownloadFile("http://qemu.weilnetz.de/w64/qemu-w64-setup-20140801.exe", "$HOME\qemu-w64-setup-20140801.exe")
PS> cmd.exe /C call $HOME\qemu-w64-setup-20140801.exe /SILENT

Add all dependencies to path, both to the environment variable and for the current session:

PS> $newPath = "$env:Path;${env:ProgramFiles(x86)}\Git\cmd;${env:ProgramFiles}\qemu"
PS> $env:Path = $newPath
PS> setx PATH $newPath

Getting the script:

PS> cd $HOME
PS> git clone https://github.com/slokesh184/windows-diskimage-builder

Running the script:

Start a new PowerShell session as administrator:

PS> Start-Process PowerShell -Verb RunAs

Getting at the file of an :

PS> $mountpoint = Mount-DiskImage -ImagePath C:\Absolute\Path\To\Your\Iso\Image.iso -PassThru
PS> $wimfilePath = ($mountpoint | Get-Volume).DriveLetter + ":\sources\install.wim"

# AFTER succesfully using the .wim in the script, don't forget to dismount the .iso:
PS> Dismount-DiskImage -ImagePath C:\Absolute\Path\To\Your\Iso\Image.iso

Creating a or :

Creating a :

PS> .\diskimagebuilder.ps1 -SourceFile $wimfilePath -VHDFile $HOME\resultingDiskImage.vhd -VHDSize 16 -OutputFormat qcow2 -VirtIOPath C:\Absolute\Path\To\VirtIO.iso
FAILURE NOTICE:

Script parameters and options: