Takeaway: How a Hyper-V VM boots up will dictate a lot, especially if optical media are interchanged. IT pro Rick Vanover shows a few ways to manage boot order for Hyper-V virtual machines in this post.
That’s when the virtual machine’s properties can be changed for the boot order. Figure A below shows one Hyper-V virtual machine having the IDE device (VHD / VHDX hard drives) being moved up to be the leading boot device:
Figure A
This is good for situations where users may map their own media, which may include bootable elements (like a recovery environment). Changing the settings in Hyper-V Manager are good for a one-off change (especially if it is sent to a template/library); but not the best situation for a large scale change.
For changing multiple virtual machines’ bootable behavior at once, PowerShell becomes the way to do it. Making that same change in PowerShell is actually quite easy. Using the Get-VM and Set-VMBios commands, this change is made on a per-VM basis. From Figure A, the DLD-2008R2 VM will have its boot order to put IDE first; the following PowerShell script will do this change (as well as query the boot order before and after the change):
get-vm DLD-2008R2 | Get-VMBiosIf this script is to apply to all VMs inventoried on a host (the only catch with PowerShell and Hyper-V Manager in changing the boot order is that the virtual machine does have to be powered off), the following PowerShell script can be used:
get-vm DLD-2008R2 | Set-VMBios -StartupOrder
@("IDE","CD","LegacyNetworkAdapter","Floppy")
get-vm DLD-2008R2 | Get-VMBios
get-vm * | Set-VMBios -StartupOrderRunning this script is shown in Figure B below for a single VM.
@("IDE","CD","LegacyNetworkAdapter","Floppy")
Figure B
Click to enlarge.
Changing the boot order in Hyper-V is actually quite easy to do, especially since it is done from the management layer of the hypervisor, rather than in the virtual machine. This TechNet blog post talks a bit more about the Set-VMBios command from PowerShell.Do you find yourself changing virtual machine startup options? If so, what situations make you need to do this? I’ve done a few but am curious what you are seeing. Share your experiences below.
0 komentar:
Posting Komentar