With the latest version of Windows Server, you can now create a new type of Virtual Machine – A generation 2 VM. These VMs now suppport a number of new features, but require a new format of disk drive. You might have thought that it would be very simple: just do a New-VHD and specify a –Generation 2 parameter. If only it were that simple.
I've struggled with working out how to do this and have not found much help out on wider interweb. Until I came across a great post from Jeff Hicks, Creating a Generation 2 Disk with PowerShell. In this post he goes over the steps required to make a Generation 2 disk – which is actually not all that easy. Unfortunately, the whole job is not doable via PowerShell cmdlets – you need to cheat a bit and use diskpart.exe. But once you know how, you can hide the details inside a function and just use that function going forward.
I am working on updating my scripts to build out my training course test lab based on Windows 10 server. I will be moving over to Gen 2 VMs (and VHDs), so this article is especially important to me!