Skip to content

Hyper-V: Remove virtual machine firmware file bootmgfw.efi

I often use virtual machines to test OSD, and usually I use same virtual machine again and again, because I don’t want to re-create my virtual machine and add it to my SCCM test collections. Yeah, I know I am lazy. 🙂 After reinstall the same virtual machine many times, you will notice there are many bootmgfw.efi in your VM settings–>Firmware.

Here is the simple way delete all the bootmgfw.efi file at once. Use powershell.

$VMName = "Your virtual machine name"
Get-VMFirmware -VMName $VMName |ForEach-Object {Set-VMFirmware -BootOrder ($_.Bootorder | Where-Object {$_.BootType -ne 'File'}) $_ }

After this, you will see your virtual machine settings became like this, and you can change back “Hard Drive” as the first boot.


Remember: “However, you have still lost that file entry which Windows setup created. It can be re-created in WMI (not through PowerShell directly) assuming you know (can calculate) the correct firmware device path. An easier way is using bcdboot inside the guest operating system once it is booted”



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.