Hyper-V is Microsoft’s hardware virtualization product, similar to VMware and Proxmox VE. Hyper-V lets you create and run a software version of a computer, called a virtual machine. Each virtual machine acts like a complete computer, running an operating system and program. There are two different generations of virtual machines in Hyper-V: Generation 1 and Generation 2 virtual machines. Generation 1 is a virtual machine that uses legacy BIOS, and a Generation 2 Hyper-V machine is a UEFI-based machine. Here are some guides I have created relating to HyperV; how to set up a VM via PXE boot on a Generation 2 VM, how to set up a VM via PXE boot on a Generation 1 VM and why does the legacy PXE not does work on Generation 2 VM.
The generation of the Hyper-V virtual machine matters because PXE uses different boot files depending on if the machine boots using Legacy BIOS or UEFI. In most cases, I recommend that you create a Generation 2 virtual machine. If you don’t have a specific reason not to which could be because you do not have UEFI enabled environment.
Problem: This is because, upon installation of the OS, this will move (change) the boot order (network) down and you may never be able to PXE boot. Most times, this prevents the F12 key from working correctly.
Solution: To resolve this, ensure, the Network option (boot order right) should be moved to the top position. You have to get this right or else it will not work.
And if this is in place and it still does not work, try the other solution suggested below because F12 is not being sent to VM console or being passed to VM itself.
Other solution: Ensure you are not kicking the control out of the VM and back to the Host. Kindly click the mouse in the VM to get control and then hit f12.