Powered by System Center
Posts tagged Convert-WindowsImage.ps1
Updated June 7, 2012
I have already blogged several times about how to create a Boot from VHD installation for the Developer and Beta versions of Windows 8 and Windows Server 8 Beta.
Now that the Release Preview version of Windows 8 and the Release Candidate version of Windows Server 2012 have been released, it is a good occasion to revisit this very flexible boot method.
My first assumption this time is that you already have a system running PowerShell 3.0 which is the case if your machine runs an earlier version of Windows (Server) 8. This blog you will learn how to configure Native VHD without touching diskpart for preparing the VHD file. In fact we are going to create a VHDX file which is recognized by Windows 8 and Windows Server 2012 machines.
A second assumption is that you have the Hyper-V role installed. This is required because we need the Hyper-V PowerShell module which comes with the Hyper-V role.
To fully understand what is going on, I suggest you first run the classical route and then be surprised by the simplest of deployment methods which has much less requirements [See update and comments Mike Kolitz below) compared to the Classical Route. More on this later on in the blog!
The Classical Route
Let’s start creating a 60GB dynamic VHDX file named ws2012rc.vhdx in a directory we shall name D:\VHDX. A downloaded ISO image file of Windows Server 2012 should be copied to D:\Download.
New-VHD -Path d:\vhdx\ws2012rc.vhdx -Dynamic -SizeBytes 60GB
Once the VHDX file is created, it can be mounted as follows:
Mount-VHD -Path D:\vhdx\ws2012rc.vhdx –verbose
As you can see in the next screen, the newly mounted VHDX has a RAW partition style, so we need to find a way to only initialize the mounted virtual hard disk.