Use bcdedit to set Windows Boot Manager and default Windows boot loader to be first in the display order of UEFI firmware

This commit is contained in:
Zehadi Alam
2024-09-05 17:57:35 -04:00
parent e62d481405
commit ddbf2b0339
@@ -554,6 +554,12 @@ If (Test-Path -Path $Drivers)
WriteLog 'Copying drivers succeeded' WriteLog 'Copying drivers succeeded'
} }
WriteLog "Setting Windows Boot Manager to be first in the display order."
Invoke-Process bcdedit.exe "/set {fwbootmgr} displayorder {bootmgr} /addfirst"
WriteLog "Windows Boot Manager has been set to be first in the display order."
WriteLog "Setting default Windows boot loader to be first in the display order."
Invoke-Process bcdedit.exe "/set {bootmgr} displayorder {default} /addfirst"
WriteLog "The default Windows boot loader has been set to be first in the display order."
#Copy DISM log to USBDrive #Copy DISM log to USBDrive
WriteLog "Copying dism log to $USBDrive" WriteLog "Copying dism log to $USBDrive"
invoke-process xcopy "X:\Windows\logs\dism\dism.log $USBDrive /Y" invoke-process xcopy "X:\Windows\logs\dism\dism.log $USBDrive /Y"