Windows 11 -- Changes boot order priority following image deployment.
-
I have a setup with Fog w/ PxE booting over UEFI and image deployments + domain joins – all working perfectly.
Our systems are mostly whiteboxes (i.e Gigabyte / Asus motherboards) with i9-14900K and NVMe SSD Boot drives.
Typically, we’d get a system, set its boot order in the BIOS/UEFI config to
UEFI: PXE over IPv4
and then leave it. That way, way, the fog agent can reboot the system which in turn causes it to boot over PxE and pull down the latest image which was all working fantastically.Unfortunately, the latest round of systems we have appear to have an annoying quirk where following image deployment, the first reboot goes via PxE, then windows does its initial boot “OOBE” setup, - and finally, it reboots a second time. After that second reboot,
Windows Boot Manager
becomes teh #1 boot device (i.e. PXE Boot removed from the primary boot order). Which means I can no longer re-image the system – if I task something via Fog, the system just gets stuck in a reboot loop because it the fog agent reboots it and the system goes straight into windows without PxE booting.Is there any easy way to resolve this? Can I maybe modify my image to prevent windows from shotgunning the boot order like that? Interestingly, once booted, if I type
bcdedit /enum /raw
I do not see PXE boot in the order. JustWindows Boot Manager
andWindowsBoot Loader
So far, I’ve tried disabling “Fast Boot” which worked for our last round of systems and also password-protecting the BIOS but windows still meddles with it.
Any guidance on how to resolve this would be extremely helpful!
-
@LiamRetrams I can’t give you the exact steps to solve this but I can point you in a direction.
You will need to solve this in the windows realm. Once oobe starts FOG imaging is out of the picture so we can’t do anything in a post install script. You will need to use the bcdedit commands from inside windows to reset the boot order. You should be able to do this within the startupcomplete.cmd batch file or using the unattend.xml file in the first run section, or possibly deploy a fog snapin to run a batch file with the bcdedit commands.
I would manually reset the boot order to the way you want it then from within windows use the bcdedit commands to look at how it is ordered via bcdedit. That should give you the structure of what you need to do with the bcdedit commands to rebuild that format on a different system.
-
@LiamRetrams I recently published a function related to this in my FogApi Powershell module (see my signature)
I posted an example of using it in a snapin to change a host’s boot order to pxe boot as the first boot option
https://forums.fogproject.org/topic/16784/powershell-snapin-no-output-non-error?_=1729112272355
as @george1421 stated this is a windows issue, part of the oobe process involves changing the boot order. But you can utilize bcdedit to fix it. I’ve made an attempt at creating a universal option with my
Set-WinToBootToPxe
function, It works for me on some Asus motherboard based systems, I’d be very interested to hear if it works on custom Gigabyte builds as well.See also
- https://github.com/darksidemilk/FogApi/blob/master/FogApi/Public/Set-WinToBootToPxe.ps1
- https://fogapi.readthedocs.io/en/latest/commands/Set-WinToBootToPxe/
- https://github.com/darksidemilk/FogApi/blob/master/FogApi/Public/Get-WinBcdPxeID.ps1
- https://fogapi.readthedocs.io/en/latest/commands/Get-WinBcdPxeId/