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.
The Hyper-V virtual machine’s generation matters because PXE uses different boot files depending on if the machine boots are 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. One reason could be that you have not yet enabled UEFI in your environment.
This blog post describes how to add a Legacy Adapter to gerenation 2 VM to enable PXE boot for devices not yet on UEFI.
If you want to learn more about Hyper-V, I recommend the courses at Pluralsight.
What is PXE boot?
PXE boot is a network boot where a small boot file is sent to a client at the initial boot-up. The PXE server typically uses WDS and DHCP to enable this communication. A virtual PXE server or a physical PXE server can be used.
Start PXE over IPv4 on a Hyper-V generation 1 machine
How do I verify the Hyper-V virtual machine generation?
If you want to verify if the Hyper-V VM is a Generation 1 or Generation 2 machine, select the VM in Hyper-V Manager and check the Generation version on the first page.
Why doesn’t legacy PXE work on generation 2 virtual machines?
A Hyper-V Generation 2 machine is like a running UEFI workstation.
The UEFI workstation could not communicate with legacy PXE, but only with UEFI boot images.
A machine configured with UEFI will use boot\x64\wdsmgfw.efi on the WDS server when starting the boot. A legacy boot will use boot\x64\wdsnbp.com.
The same issue with UEFI communication also applies to Hyper-V Generation 2 machines. This guide explains how to start PXE over IPv4 on Generation 1 Hyper-V VMs.
If your network is configured to deploy boot images using legacy methods, you must configure the virtual machine’s hardware.
How to configure a Generation 2 VM for legacy PXE boot
Step #1 – Create a virtual switch
First, you need to create a virtual switch. The virtual switch is required for the Virtual Machine to communicate with the network. If you have already created a virtual machine for your network, you can skip this step. Start by right-clicking the Hyper-V host in Hyper-V Manager and selecting Virtual Switch Manager.
Create a new Virtual Switch. Select External. External is similar to “Bridged” if you are using other virtualization platforms.
Give the new Virtual Switch a name. I named mine “Bridged.”
Step #2 – Add a legacy network adapter
By default, there is only a “Standard Network Adapter” installed on the Virtual Machine, but for PXE functionality, it requires you to add a Legacy Network Adapter.
Go to the Legacy Network Adapter that you just added and specify that it should use the Virtual Switch that you just created.
Step #3 – Configure startup order
6. Now, we need to make sure that the client boots first using the Legacy Network Adapter. Just select the Legacy Network Adapter and move it to the top of the list using the buttons.
Step #4 – Start the Hyper-V virtual machine
Start your Virtual Machine, and now PXE boot should work 🙂
As I mentioned in the introduction, in most cases, I recommend creating a Generation 2 virtual machine in Hyper-V if there are no specific reasons not to do so.
For a thorough explanation about choosing a Generation 1 or Generation 2 VM, refer to Microsoft Docs.
Do you usually create Generation 1 or Generation 2 machines in your Hyper-V environment? Let me know in the comments below 🙂
If you want to learn more about Hyper-V, I would highly recommend the courses at Pluralsight.