Querying the System Registry: In your WinPE environment and open a command prompt. Enter the following command:

1
reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType

The output will provide a value that indicates the mode:

  • 0x2 denotes UEFI mode.
  • 0x1 signifies Legacy BIOS mode.

In the Absence of PEFirmwareType Value: If you don’t see the PEFirmwareType value, you might need to initialize the WinPE environment. Use the command:

1
winpeinit


Automating the Detection with a Script:
For those who prefer automation, here’s a script that can detect the BIOS mode and execute mode-specific commands:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@echo off
wpeutil UpdateBootInfo
for /f "tokens=2* delims=   " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET FIRMWARE=%%B
if %FIRMWARE%==0x1 goto BIOS
if %FIRMWARE%==0x2 goto UEFI
goto END
 
:UEFI
:: ajouter votre script ICI
goto END
 
:BIOS
:: ajouter votre script ICI
goto END
 
:END

0 Comments

Leave a Reply

Avatar placeholder

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.