Windows Preinstallation Environment Network Boot Guide (WinPE)
The pre-installation environment can be used not only to install the operating system, but also as the basis for system administrator tools, for example, system recovery, anti-virus treatment, network diagnostics, etc. In this article, we will consider a standard WinPE image without adding administrative utilities, since this is a topic for a separate article.
The WinPE network boot sequence starting with version 2.0 is as follows:
To obtain the above files, there is no need to deploy (download and install) Windows AIK packages, as said, for example, here . A similar OEM Preinstallation Kit is also optional. We need only the installation disk itself or even its image, in the latter case, your computer must have 7Zip or any other program that will allow you to copy files from ISO and WIM images. Therefore, do not waste time downloading and installing Windows AIK. Any architecture-compatible distribution of Windows 7, 8, or even 10 is suitable. For maximum compatibility, it is better to use the x86 architecture.
Files can
In the case of dism, you will need a computer with Windows 7-10, since dism does not work on Windows XP, as with the bcdedit utility. You can work with these utilities only from under the administrator, that is, we find the “Command line” item in the start button, right-click on this item and select “Run as administrator” from the context menu (there are many ways, all of these methods are for everyone it makes no sense to list operating systems, if it doesn’t work, try turning on the reasoning box). You can get help on working with this utility by typing in a running command line:
For example, we want to make sure that this is the WIM file we need, that is, we need information about the images in the WIM file, for this we get help about the command
Mount the image with the following command:
Please note that the path to the .wim file and the connection directory must exist on this computer, and the image index can be found with the command
For those who want to add drivers, you need the command:
If you need to add additional packages, for example, such as: WMI, HTA, MDAC, NetFX, PPPoE, PowerShell, scripting, etc., you must first find them. For example, install the Windows OPK or AIK or ADK. Then execute the command:
Next, you need to disable the image with the command:
Next, we'll look at pxelinux, the PXE network bootloader from the syslinux package that you need to download . Unzip the downloaded file, but before we copy the files, we will figure out the root directory. Suppose we use Tftpd32 under the Windows operating system, and we make the root directory
The network loader is not very different from the parent syslinux project, so there’s a lot that applies when booting from a USB flash drive or CD, and vice versa. Create a pxelinux.cfg folder, in which there will be a single file for now (then, with the growth of download options, the number of configuration files will increase) - default, with the following contents:
The first line sets the graphic nature of the menu, the second - the name of the entire menu. Then there are two menu items that are identified as bootlocal and winpe, and the screen will display: Boot local disk and WinPE. As you might guess, the first menu item is the default item and provides local loading, but we are interested in the second item. It turns out some kind of confusion, at first it was said about
Also in the root folder we must put
We can run DHCP and TFTPD (in our example, it is Tftpd32), just check the settings are correct: directory -
Consider the last question in our article: “What if you need to change the default location of WinPE boot files?” Then we need to make changes to the bcd file. Actually, the bcd file is a regular registry hive and can be loaded with standard regedit, but it will not be convenient to work with binary data, so we will use the bcdedit utility. As in the work with the previous utility, we need administrator mode, so if you closed the command prompt window, you need to open it in the same way. Help on working with the bcdedit utility can be obtained by typing:
First, let's determine that the% BCD% variable will contain the full name of the new BCD file, create this file:
Next, create a new record of additional parameters required by the boot manager for electronic disk devices:
We set two parameters, the second refers to the% SDI% variable, which contains the path \ boot.sdi relative to the boot device (originally it was \ boot \ boot.sdi):
Create a new entry for WinPE:
The result of the last command will be the display of the GUID in curly brackets, then we will denote it as the variable% GUID%. In fact, this could be automated using the FOR command, but then it’s more difficult to parse them. Set the system root directory parameter:
Set the parameters for determining HAL and WinPE:
Set the parameters of the device containing the operating system and the device containing the% WIM% file, for example \ windows \ winpe.wim:
Create another boot manager entry:
Set the wait parameter:
Set the priority:
That's it, the BCD file is ready, you can put it in the boot directory of our TFTPD server.
The WinPE network boot sequence starting with version 2.0 is as follows:
- the network core is loading
pxeboot.com
; - the network core loads the standard boot manager
bootmgr.exe
, then the network boot is practically no different from the boot from other media; - the boot manager reads the file
BCD
(boot configuration data), where the configuration information (the location of the boot files) is written, loads the necessary font (wgl4_boot.ttf
) and the virtual disk driverboot.sdi
, then the WinPE image is loaded; - The download manager transfers control to the program specified in the path parameter of the BCD file.
To obtain the above files, there is no need to deploy (download and install) Windows AIK packages, as said, for example, here . A similar OEM Preinstallation Kit is also optional. We need only the installation disk itself or even its image, in the latter case, your computer must have 7Zip or any other program that will allow you to copy files from ISO and WIM images. Therefore, do not waste time downloading and installing Windows AIK. Any architecture-compatible distribution of Windows 7, 8, or even 10 is suitable. For maximum compatibility, it is better to use the x86 architecture.
Files can
boot.sdi
also bcd
be taken in the directory boot
, here you can also take the whole subdirectory fonts
(the font is located therewgl4_boot.ttf
), and only the file is needed from the sources directory boot.wim
. You will need two more files that are located in the boot.wim image. The easiest way is to use the 7Zip graphical file manager, but if you intend to add drivers or packages to the WinPE image, it is better to use the dism utility. Next, we will consider the option with dism, and for those who will be quite standard way, to announce: the files ( pxeboot.n12
and bootmgr.exe
) are located in windows\boot\pxe
. The file pxeboot.n12
differs from the one indicated above pxeboot.com
in that it does not require a keystroke F12
.In the case of dism, you will need a computer with Windows 7-10, since dism does not work on Windows XP, as with the bcdedit utility. You can work with these utilities only from under the administrator, that is, we find the “Command line” item in the start button, right-click on this item and select “Run as administrator” from the context menu (there are many ways, all of these methods are for everyone it makes no sense to list operating systems, if it doesn’t work, try turning on the reasoning box). You can get help on working with this utility by typing in a running command line:
dism /?
For example, we want to make sure that this is the WIM file we need, that is, we need information about the images in the WIM file, for this we get help about the command
/Get-Wiminfo
by typing in the console:dism /get-wiminfo /?
Mount the image with the following command:
dism /mount-wim /wimfile:<путь_к_WIM-файлу> /index:<индекс_образа> /mountdir:<каталог_подключения>
Please note that the path to the .wim file and the connection directory must exist on this computer, and the image index can be found with the command
/Get-Wiminfo
. In the connection directory we find the windows \ boot \ pxe folder, in which we take two files: pxeboot.n12
and bootmgr.exe
. For those who want to add drivers, you need the command:
dism /image:<каталог_подключения> /Add-Driver /driver:<каталог_c_драйвером> /recurse /ForceUnsigned
If you need to add additional packages, for example, such as: WMI, HTA, MDAC, NetFX, PPPoE, PowerShell, scripting, etc., you must first find them. For example, install the Windows OPK or AIK or ADK. Then execute the command:
Dism /image:<каталог_подключения> /Add-Package /PackagePath: <путь_и_имя_пакета_cab>
Next, you need to disable the image with the command:
dism /unmount-wim /mountdir:<каталог_подключения> /commit
Next, we'll look at pxelinux, the PXE network bootloader from the syslinux package that you need to download . Unzip the downloaded file, but before we copy the files, we will figure out the root directory. Suppose we use Tftpd32 under the Windows operating system, and we make the root directory
C:\tftpd32
. Further, we will count all the paths from this directory, but we will not indicate it, moreover, the path will use the forward slash, and not the reverse as in Windows. That is, if indicated pxelinux.cfg/default
, then the real path will be C:\tftpd32\pxelinux.cfg\default
, and default is a file without an extension. Copy the following files from the directory where you unpacked syslinux into the root directory (that is C:\tftpd32
):bios\core\pxelinux.0
(actually the network loader itself);bios\com32\menu
two files from the catalog :menu.c32
andvesamenu.c32
(menu.c32 we will use only for those machines where vesamenu.c32 does not work);bios\com32\chain\chain.c32
(bootloader management module, usually used for local boot);bios\com32\elflink\ldlinux\ldlinux.c32
(secondary bootloader, required when using pxelinux.0);bios\com32\lib\libcom32.c32
(required when using chain.c32);bios\com32\libutil\libutil.c32
(required when using chain.c32);bios\memdisk\memdisk
(driver for loading floppy images, hard drive, ISO, etc.).
The network loader is not very different from the parent syslinux project, so there’s a lot that applies when booting from a USB flash drive or CD, and vice versa. Create a pxelinux.cfg folder, in which there will be a single file for now (then, with the growth of download options, the number of configuration files will increase) - default, with the following contents:
UI vesamenu.c32
MENU TITLE PXE Special Boot Menu
LABEL bootlocal
MENU LABEL ^Boot local disk
MENU DEFAULT
LOCALBOOT 0
TIMEOUT 80
TOTALTIMEOUT 9000
LABEL winpe
MENU LABEL ^WinPE
KERNEL pxeboot.0
The first line sets the graphic nature of the menu, the second - the name of the entire menu. Then there are two menu items that are identified as bootlocal and winpe, and the screen will display: Boot local disk and WinPE. As you might guess, the first menu item is the default item and provides local loading, but we are interested in the second item. It turns out some kind of confusion, at first it was said about
pxeboot.com
, copied pxeboot.n12
, but we prescribe pxeboot.0
. The fact is that pxelinux has its own requirements for the name of network bootloaders - the extension of such files .0
, by the way, do not confuse pxeboot.0
which we took from the WinPE image pxelinux.0
from syslinux. The second is required to display the menu, and the first is loaded only after selecting the appropriate menu. So we should rename pxeboot.n12
topxeboot.0
and put in the root folder. Also in the root folder we must put
bootmgr.exe
. Create a subfolder in the root folder boot
where you want to place the two files, bcd
and boot.sdi
and directory fonts
, still have to create a directory sources
where to copy the file boot.wim
. If you are satisfied with the similar arrangement of all boot files, then the file bcd
does not need to be changed. The trick here is that network booting is similar to booting from a CD or flash drive. We can run DHCP and TFTPD (in our example, it is Tftpd32), just check the settings are correct: directory -
C:\tftpd32
, file -pxelinux.0
, choice of network interface, etc. If there are errors or the lack of the desired result, see the output in the log (Log Viewer). Separately, it should be said about computers with a lack of compatibility with BIOS, that is, only with UEFI. For such computers, other files are needed:- instead
pxelinux.0 syslinux.efi
, which is locatedefi32\efi\syslinux.efi
for 32-bit systems orefi64\efi\syslinux.efi
for 64-bit; - instead,
ldlinux.c32
respectively,efi32\com32\elflink\ldlinux\ldlinux.e32
orefi64\com32\elflink\ldlinux\ldlinux.e64
.
Consider the last question in our article: “What if you need to change the default location of WinPE boot files?” Then we need to make changes to the bcd file. Actually, the bcd file is a regular registry hive and can be loaded with standard regedit, but it will not be convenient to work with binary data, so we will use the bcdedit utility. As in the work with the previous utility, we need administrator mode, so if you closed the command prompt window, you need to open it in the same way. Help on working with the bcdedit utility can be obtained by typing:
bcdedit /?
First, let's determine that the% BCD% variable will contain the full name of the new BCD file, create this file:
bcdedit /createstore %BCD%
Next, create a new record of additional parameters required by the boot manager for electronic disk devices:
bcdedit /store %BCD% /create {ramdiskoptions} /d "Ramdisk options"
We set two parameters, the second refers to the% SDI% variable, which contains the path \ boot.sdi relative to the boot device (originally it was \ boot \ boot.sdi):
bcdedit /store %BCD% /set {ramdiskoptions} ramdisksdidevice boot
bcdedit /store %BCD% /set {ramdiskoptions} ramdisksdipath %SDI%
Create a new entry for WinPE:
bcdedit /store %BCD% -create /d "WinPE Boot Image" /application osloader
The result of the last command will be the display of the GUID in curly brackets, then we will denote it as the variable% GUID%. In fact, this could be automated using the FOR command, but then it’s more difficult to parse them. Set the system root directory parameter:
bcdedit /store %BCD% /set %GUID% systemroot \Windows
Set the parameters for determining HAL and WinPE:
bcdedit /store %BCD% /set %GUID% detecthal Yes
bcdedit /store %BCD% /set %GUID% winpe Yes
Set the parameters of the device containing the operating system and the device containing the% WIM% file, for example \ windows \ winpe.wim:
bcdedit /store %BCD% /set %GUID% osdevice ramdisk=[boot]%WIM%,{ramdiskoptions}
bcdedit /store %BCD% /set %GUID% device ramdisk=[boot]%WIM%,{ramdiskoptions}
Create another boot manager entry:
bcdedit /store %BCD% /create {bootmgr} /d "Windows BootManager"
Set the wait parameter:
bcdedit /store %BCD% /set {bootmgr} timeout 30
Set the priority:
bcdedit /store %BCD% /set {bootmgr} displayorder %GUID%
That's it, the BCD file is ready, you can put it in the boot directory of our TFTPD server.