So we finally bit the bullet and started using UEFI for our desktops. It works perfectly for our Hyper V images - we can create gen 2 VMs all day long. This is true until we need to reimage. How do I set a Gen 2 VM with an existing OS to boot from PXE?
For the life of me I can't change the boot order to allow me to boot from network. In the firmware interface under system settings it only lists the windows boot managers. It's painful and slow to have to remove and recreate the VMs each time we want to try a new variation of an image.. How can we tackle this? I'm guessing there's some buried flag in the VM I need to edit with Powershell, but the documentation is lacking.
I am having the same issues/problems as Tim Brigham. That you (Grigory) do have the options, does not mean we do have them. Here is the screenshot of the boot options I have in the VM:
Holding down shift doesn't work as you describe either.This does seem to work.How to change the boot order (NIC first):
I have done some research and it seems that you can only change the boot order for Generation 2 VM's, running on Windows Server 2012 R2 or later, using powershell. I used the following powershell commands to change the boot order:
Now the VM will boot from the network. Afterwards you probably need/want to change the boot order back to file being the first boot device. You could also choose to keep the network as the first boot device.
Update 15-3-2017
Heads-up warning
Every time you re-image an UEFI machine, an extra 'bootmgfw.efi' will be added to the firmware list. Removing the obsolete bootmgfw files is not a straightforward process; you'll need to use BCDEDIT in the VM itself to clean them up. A guide on how to do this can be found here. When using this guide, be careful not the remove the GUIDs linked to the EFI boot devices
How to change the boot order (File first):
If you have removed the obsolete firmware entries using the guide mentioned above, you can change the boot order back to file being first using the following powershell code:
Note: I find it weird that the firmware for Gen2 VM's running on windows 2012 R2 and up only show the 'file' option. I am wondering: is this by design or is it a bug?
I have Windows 10 VM running under Windows 8.1 and Windows 10 Hyper-V with Secure Boot enabled and I am able to see Network adapter as the boot source and can move it up the boot queue on both machines, and even further to that, I can actually boot into my WDS images.
Another alternative - restarting guest from console while holding shift key (any UEFI Windows), which presents you with troubleshooting and boot options where you can select booting from network.
But just as I have tested this, I have received TFTP download timeout, which was fixed by tweaking WDS Properties -> TFTP -> Maximum block size: 1024 instead of default 0.