Ghost Solution Suite

 View Only
  • 1.  How to identify if systems are booted into UEFI or BIOS mode in WinPE.

    Posted Jan 18, 2017 05:45 PM

    I have just upgraded to GSS 3.1 MP5... I should have posted this long ago but worked around it instead.  Looking for a way of programatically indentifying wether a system is booted into UEFI or BIOS mode.  On USB drives I am able to use the Microsoft recommended method of using a command to query a value in the registry of the booted winpe environment for a value.  The microsoft method is found at the followiing URL:

    https://msdn.microsoft.com/en-us/library/windows/hardware/dn293283.aspx

    The problem is that the value referenced above is not present in any Altiris or GSS registry when booted into WinPE.

    We have some scripts that run in WinPE that depend on wether the system is being imaged in UEFI mode or Legacy mode and the scripts behave differently based on the boot mode.  Any assistance is greatly appreciated.  Thanks :)

     



  • 2.  RE: How to identify if systems are booted into UEFI or BIOS mode in WinPE.
    Best Answer

    Posted Jan 19, 2017 04:57 PM

    Hooray!!! So I was able to resolve this relatively quickly thanks to the almighty Google and some help from a colleague.  The way I was able to resolve this was by compiling some source code readily available on the interwebs.  The sourcecode is only a few short lines and the result after compiling are small executables that run natively in WinPE without any additional dependencies.  I compiled both 32-Bit and 64-Bit executables and they were only about 100kb each.  I am now able to use these executables in both 32-Bit and 64-Bit WinPE environments to accurately determine what bootmode the systems are running in.

    The sourcecode is available here:

          https://gitlab.com/xcat/xcat-core/blob/32ff6338de3a746177fd7c18a76cf9057454e1e0/xCAT-server/share/xcat/netboot/windows/detectefi.cpp

     

    I then downloaded the free version of Visual Studio (Community Edition) and installed all of the available components for C++

    Visual Studio Community (Free) is available here:

         https://www.visualstudio.com/downloads/

     

    I then used the comandline versions of the compiler to compile 32 and 64 bit versions of the application as shown below:

    • (Right Click Run as Administrator) on one of the following Tools or Both if you need both architectures like I did.

                 VS2015 x86 Native Tools Command Prompt

                 VS2015 x64 Native Tools Command Prompt

    • Path to location of .cpp file
    • Type the following command:

                 cl efidetect.cpp

    Thats it, now I can detect what bootmode the system is runnning in by executing one of the executables while in WinPE.  Hope this helps others.

    If you are unable to compile them or need assistance, please PM me and I would be happy to help you accomplish the same.

    Thanks guys :)



  • 3.  RE: How to identify if systems are booted into UEFI or BIOS mode in WinPE.

    Posted Feb 02, 2017 03:19 AM

    Or you could just grab the solutions from here:

    https://social.technet.microsoft.com/Forums/office/en-US/6cbb488d-3062-4aad-b712-7a9e4d045b13/how-to-use-wmi-to-query-to-distinguish-legacy-and-uefi-mode-windows?forum=winserverManagement