On start up how can a program determine if it is running in a PE or regular Windows (7+)?
One way would be to check if the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE exists. What's the 'correct' way?
Posted 24 June 2017 - 09:58 AM
On start up how can a program determine if it is running in a PE or regular Windows (7+)?
One way would be to check if the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE exists. What's the 'correct' way?
Posted 24 June 2017 - 11:00 AM
just an idea, what about checking if wpeutil exist on the system?
Posted 24 June 2017 - 12:13 PM
Check the Systemsetupinprogress key:
HKEY_LOCAL_MACHINE\System\Setup\SystemSetupInProgress
Wonko
Posted 24 June 2017 - 12:56 PM
Hello,
two more keys may be of interest.
They are not present on installed NT_6 System but created on PE-boottime:
HKEY_LOCAL_MACHINE\system\currentcontrolset\control\
since PE2 (Vista):
PEBootType --> indicates PE running from OpticalDisc or HDD.
since PE4(?):
PEFirmwareType --> indicates PE running in UEFI mode. (Returns 0x2)
PEBootType_Flat_PEFirmwareType_2_UEFI.jpg 175.34KB 0 downloads PEBootType_OpticalDrive_PEFirmwareType_1_Legacy.jpg 182.66KB 0 downloads
Regards T.
Posted 24 June 2017 - 01:46 PM
Thanks everyone.
SystemSetupInProgress = 0 means regular windows
SystemSetupInProgress = 1 means PE, right?
Posted 24 June 2017 - 10:03 PM
Posted 24 June 2017 - 11:20 PM
Posted 25 June 2017 - 09:03 AM
Yep.Thanks everyone.
SystemSetupInProgress = 0 means regular windows
SystemSetupInProgress = 1 means PE, right?
Posted 25 June 2017 - 10:20 AM
Hi gbrao,
IsWinPE is a small tool to detect if the user is operating under Windows PE ( Preinstallation Environmet ) or Windows. The environment variable ERRORLEVEL is set to 1 if WinPE is detected. Otherwise, ERRORLEVEL is set to 0
The tool checks the existence of the key :
HKLM\SYSTEM\CurrentControlSet\Control\MiniNT
test.bat :
IsWinPE.exe @IF %ERRORLEVEL% == 1 ( @echo Operating in WinPE environment ) ELSE ( @echo Operating in Windows environment )
Posted 25 June 2017 - 11:27 AM
next to some registry files:
-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinPE
-HKLM\SYSTEM\CurrentControlSet\Control\MiniNT
-HKEY_LOCAL_MACHINE\system\currentcontrolset\control\PEBootType (PE2)
-HKEY_LOCAL_MACHINE\system\currentcontrolset\control\PEFirmwareType (PE4)
-HKEY_LOCAL_MACHINE\System\Setup\SystemSetupInProgress
or some files in system folder
-wpeutil
one can also check some env variables :
-%systemdrive%=x:
-%username%=system
-%userprofile%=x:\windows\systemuserprofile...
Posted 26 June 2017 - 07:54 PM
Would this be of use?
http://rmprepusb.blo...-winpe-via.html
@echo off wpeutil UpdateBootInfo > nul color 1f for /f "tokens=2* delims= " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET Firmware=%%B :: Note: delims is a TAB followed by a space. if %Firmware%==0x1 echo WinPE booted in BIOS mode. if %Firmware%==0x2 echo WinPE booted in UEFI mode. echo. pause
0 members, 1 guests, 0 anonymous users