Hi Everyone
We have a tasks to be done, where we need to reboot systems on the Bios Setup Screen.
We understand that what Windows does is to work with some UEFIVariable (OSIndications), to manage the next boot of the system.
We have started to try to use the uefi var, OSIndications, that can be accessed using the windows apis like this:
The problem is that at some systems this does not work. When the system is working with CSM enabled at the BIOS the var is not available, since the BIOS works on a “legacy” compatible mode, having no UEFIVars available to windows.
We also got the same problem with the command:
shutdown /r /fw
(When trying to do it on a CSM enabled system we got the same error code as mentioned above)
Another possible way we discovered was using the bcd.exe, by passing as argument the firmware guid, as below:
bcdedit /set {fwbootmgr} bootsequence {e5fed296-00d1-11ea-9dfa-806e6f6e6963}
But this can’t be done on some systems, because there is no guid to be used at the bcdedit command.
(when using bcdedit /enum firmware or all to check for the firmware Setup we cant find anything)
Also even on the systems that do have the firmware setup with guid avaiable for bcdedit to use, we stil need a reliable way to get to this GUID.
This GUID is unique in every system and to get it to later pass it as a parameter to bcdedit there are two ways.
- First would be to read the bcdedit enum command result and try to get the GUID by the description. That is not a good way because for start the description is localized. (and also if there is an added extra item with the same description we would not be able to differentiate between the two).
- The second one is to access it via windows register on HKEY_LOCAL_MACHINE\BCD00000000\Objects{objectGuid}. While acessing this register key we can find the GUID we need but to get to it we need something to seach for. Checking inside this key we find a FirmwareVariable value that I think its what we can use on our search. The problem is there is no documentation on this and this byte array (binary data) its actually not the same on diferent systems. (but its pretty close).
So the questions are.
Is there a way to manage the system’s next boot on a reliable way? (that would work on all windows versions with uefi and legacy mode)
Why some systems do not have a firmware Setup that enables us to do this via BCDEdit?
Is there any documentation on the windows register FirmwareVariable for bcd? Something that tells us witch part of it can be checked for and would be equal on all systems.
Important note: We have tested it on several Windows 10 systems and while Setfirmwareenvironmentvariablea and the shutdown /r /fw command seems to work the same way (both didn’t work when on a CSM enabled system), the BCDEdit does work on CSM enabled systems but we still have the problem that not all systems seems to have the GUID for it to work and even on the ones that do we dont have a documentation on that to seach for it the right way.