Creating a Generation 2 Disk with PowerShell
When Windows Server 2012 R2 hit the datacenter, and with it a new version of Microsoft Hyper-V, it offered the option to create a new kind of virtual machine. These “Gen 2″, or generation 2, virtual machines These VMs can now support UEFI boot, among other features. However, they also require a specific disk configuration. If you’ve been reading this blog for a while, you should have seen my other articles on creating and managing VHD and VHDX files using Windows PowerShell. So now it seems, we need to see what it takes to create one of these new Gen 2 devices which by the way are only compatible with 64-bit flavors of Windows 8.1 and Windows Server 2012 R2.
To follow along, you will need to be running the most current version of Hyper-V, either on a server or a Windows 8.1 client. In addition to PowerShell 4.0 you will also need the Storage module. As you will see, you will need to create and format some partitions and the Storage cmdlets are very convenient. Let’s begin by defining a variable that holds the path to the new disk file, which has to be a VHDX file.
Creating the VHDX file is pretty easy.
Read the entire article here, Creating a Generation 2 Disk with PowerShell