Hyper-V virtual machines have the ability to PXE boot. Obviously, PXE boot raises some security concerns. The problem is, unlike a typical physical machine's firmware, there isn't an obvious way to disable PXE boot altogether.

Hyper-V manager shows each of the VM's network adapters in Settings=>Firmware=>Boot Order:

enter image description here

You can move a network adapter to the bottom of the boot order, but you can't remove it altogether from that screen. So if, for some reason, Hyper-V can't boot from any of the other drives, the VM still tries to PXE boot and shows this screen:

enter image description here

I've scoured Settings=>Network Adapter for a way to disable PXE boot to no avail.

So my questions are:

  1. How do you disable PXE boot in a Hyper-V VM?
  2. If you can't disable PXE boot, is there a good reason why?

I'm using Windows Server 2012 R2

  • Regarding your concerns about PXE > The implementation of PXE in a corporate environment may raise > concerns about security. This document shows why these concerns are > mostly unfounded. www-01.ibm.com/support/docview.wss?uid=swg21247020 – Pat Aug 12 '14 at 14:31

Use Powershell to Remove Network Boot Devices from the Boot Order

You can use PowerShell to strip the Network BootTypes from the VMs boot order.

Extract the Current Boot Order

Using Powershell you can use this command to extract the current boot order:

$old_boot_order = Get-VMFirmware -VMName testvm -ComputerName MyHyperVHost `
                  | Select-Object -ExpandProperty BootOrder

If you inspect $old_boot_order You should see the list of boot devices for testvm. Something like this:

enter image description here

Strip the Network Boot Devices

You can strip the boot devices from the boot list with the Network BootType using this command:

$new_boot_order = $old_boot_order | Where-Object { $_.BootType -ne "Network" }

Inspecting $new_boot_order should look something like this with no more Network boot devices:

enter image description here

Set the New Boot Order

To set the new boot order for the VM use this command:

Set-VMFirmware -VMName testvm -ComputerName MyHyperVHost -BootOrder $new_boot_order

Confirm the New Boot Order

To confirm what you did use that first Get-VMFirmware command again:

Get-VMFirmware -VMName testvm -ComputerName MyHyperVHost `
| Select-Object -ExpandProperty BootOrder

Beware: If you use both PowerShell and Hyper-V manager to make changes to the boot order, PowerShell may report erroneous (out-of-date) boot order. See also this technet thread.

  • What do you do if Get-VMFirmware : The Generation 1 virtual machine or snapshot "ubuntu504" does not support the VMFirmware cmdlets – nelaaro Feb 6 '19 at 8:56
  • @nelaaro I know I'm 2 years late, but I've added an answer for the likes of you and me that still use Gen1 – LuxZg Nov 25 '20 at 19:33

In case someone lands here looking for Generation 1 VM solution, I ended up looking for it all around the place.

Found it was really simple, in MS official docs:


Set-VMBios TestVM -StartupOrder @("Floppy", "LegacyNetworkAdapter", "CD", "IDE")

This example configures virtual machine TestVM to check for a boot device in the following order: floppy disk, network, CD drive, hard disk.

The Set-VMBios supports -VMName <name of VM> as well, I use that for readability, while MS docs obviously uses shorter form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.