Monday, May 12, 2014

Configuring FirstBootDevice for Gen2 VM Templates

Since Microsoft announced “Generation 2” VMs in Hyper-V with Windows Server 2012 R2, many people have made this the default generation for all their new VM deployments.
And of course, when using VMM, you are creating VM templates based on Gen 2 base OS.

For more information about Gen2 VM and the support in Virtual Machine Manager, go ahead and read a blog post I wrote earlier, on what this really is, what it means and how to create them with VMM: http://kristiannese.blogspot.no/2013/11/how-to-create-gen2-vm-with-scvmm-2012-r2.html

During the past few months, we’ve seen several threads in the VMM forums at TechNet that several users have troubles with deployment of Gen2 VMs.
It was hard to detect the root cause, as many people had created their VMs outside of VMM, with either FCM, Hyper-V Manager or Hyper-V Manager cmdlets, or other deployment tools.
However, there was a trend and Microsoft published a kb recently.

When you use System Center 2012 R2 Virtual Machine Manager for template creation, you may discover that Generation 2 virtual machines (VMs) based on this template cannot start after creation. Virtual Machine Manager returns the following error:

Error (23352) VMM cannot find the device or this device is not valid for a boot device.


To resolve this issue, you must change the VM template, and this can easily be done through PowerShell:

Get-SCVMTemplate –name “yourGen2TemplateName” | Set-SCVMTemplate –FirstBootDevice “SCSI,0,0”

This will ensure that the VMs you deploy based on this template, will successfully start.

Many of my customers runs big datacenters and have a lot of templates that they use together with tenant portals, like Azure Pack or something they developed by themselves.
The list of templates can be huge, so we should carefully look at our templates so that we don’t configure this for our Gen1 templates, as this change would result in a bad experience for those (Gen1 requires IDE controller to start).

First, we use the VMM module to search for all of our Gen 2 templates that have anything but SCSI as their FirstBootDevice:

Get-SCVMTemplate | where-object {$_.FirstBootDevice -cnotcontains "SCSI,0,0" -and $_.Generation -eq "2"

If this results any VM templates, then you should follow up with piping that into: Set-SCVMTemplate –FirstBootDevice “SCSI,0,0”

Get-SCVMTemplate | where-object {$_.FirstBootDevice -cnotcontains "SCSI,0,0" -and $_.Generation -eq "2"} | Set-SCVMTemplate -FirstBootDevice "SCSI,0,0" 


Now, make sure your Gen2 VMs are configured correctly.

No comments: