Windows PE ( Preboot Environment ) is a cut down operating system that allows you to install 32-bit and 64-bit versions of Windows on new hardware. This was first introduced with Windows Vista and is now part of Windows 7.
To create a Windows PE environment you need to download the Windows AIK and install it.
Once installed you should see a “Microsoft Windows AIK” group in your programs. Open the “Deployment Tools Command Prompt” ( Note : If you are running this on Windows 7 press your right mouse button and run it as an administrator )
Creating a Dual Boot Image ( 32-bit and 64-bit )
In order to dual boot we need to have the main boot image for both 32-bit and 64-bit systems. To create the 64-bit boot image do the following:
mkdir c:\Temp
call copype.cmd AMD64 c:\Temp\Boot64
copy winpe.wim c:\Temp\winpe_x64.wim
Now close the window and open a new “Deployment Tools Command Prompt”.
This time we will get the 32-bit boot image and the other files needed. To do this use the following commands :
call copype.cmd x86 C:\Temp\Boot
del /Q etfsboot.com
move ISO\boot\boot.sdi boot.sdi
rmdir /S /Q ISO
imagex /mount winpe.wim 1 mount
copy mount\Windows\Boot\PXE\pxeboot.n12 pxeboot.n12
copy mount\Windows\Boot\PXE\bootmgr.exe bootmgr.exe
copy mount\Windows\System32\bcdedit.exe bcdedit.exe
imagex /unmount mount
rmdir /Q mount
ren winpe.wim winpe_x86.wim
copy c:\Temp\winpe_x64.wim ./
What this does is to create a 32-bit image, pulls the network boot files and boot editor from that image and finally copies the 64-bit boot file into the same directory.
The next bit that is needed is to create the BCD file. This has been simplified by using the following batch file. This will give you the option to choose either 32-bit or 64-bit PE environment.
echo *** Creating WinPE BCD (boot configuration data) File
set BCDFILE=BCD
Bcdedit -createstore “%BCDFILE%”
Bcdedit -store “%BCDFILE%” -create {ramdiskoptions} -d “Ramdisk options”
Bcdedit -store “%BCDFILE%” -set {ramdiskoptions} ramdisksdidevice boot
Bcdedit -store “%BCDFILE%” -set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
Bcdedit -store “%BCDFILE%” -deletevalue {ramdiskoptions} description
rem 32Bit
for /f “tokens=1-3” %%a in (‘Bcdedit -store “%BCDFILE%” -create -d “Windows PE 32-Bit” -application osloader’) do set guid1=%%c
Bcdedit -store “%BCDFILE%” -set %guid1% systemroot \Windows
Bcdedit -store “%BCDFILE%” -set %guid1% detecthal Yes
Bcdedit -store “%BCDFILE%” -set %guid1% winpe Yes
Bcdedit -store “%BCDFILE%” -set %guid1% description “Windows PE 32-Bit”
Bcdedit -store “%BCDFILE%” -set %guid1% osdevice ramdisk=[boot]\Boot\winpe_x86.wim,{ramdiskoptions}
Bcdedit -store “%BCDFILE%” -set %guid1% device ramdisk=[boot]\Boot\winpe_x86.wim,{ramdiskoptions}
rem 64Bit
for /f “tokens=1-3” %%a in (‘Bcdedit -store “%BCDFILE%” -create -d “Windows PE 64-Bit” -application osloader’) do set guid2=%%c
Bcdedit -store “%BCDFILE%” -set %guid2% systemroot \Windows
Bcdedit -store “%BCDFILE%” -set %guid2% detecthal Yes
Bcdedit -store “%BCDFILE%” -set %guid2% winpe Yes
Bcdedit -store “%BCDFILE%” -set %guid2% description “Windows PE 64-Bit”
Bcdedit -store “%BCDFILE%” -set %guid2% loadoptions ramdisk=[boot]\Boot\winpe_x64.wim,\”DISABLE_INTEGRITY_CHECKS”
Bcdedit -store “%BCDFILE%” -set %guid2% osdevice ramdisk=[boot]\Boot\winpe_x64.wim,{ramdiskoptions}
Bcdedit -store “%BCDFILE%” -set %guid2% device ramdisk=[boot]\Boot\winpe_x64.wim,{ramdiskoptions}
rem Setup Bootmanager
Bcdedit -store “%BCDFILE%” -create {bootmgr} -d “Windows 7 BootManager”
Bcdedit -store “%BCDFILE%” -set {bootmgr} timeout 10
Bcdedit -store “%BCDFILE%” -set {bootmgr} displayorder %guid1% %guid2%
Bcdedit -store “%BCDFILE%” -enum all
This will create the boot file (BCD) and at the end show you the boot manager configuration.
You will then have the following files in your Boot directory
BCD BCD.LOG boot.sdi winpe_x64.wim
bcdedit.exe bootmgr.exe pxeboot.n12 winpe_x86.wim
You can safely delete the file bcdedit.exe as that is not longer needed.
All the other files need to be copied to your tftp server into a folder called “Boot” ( This is case sensitive ). So on a linux tftp server this will be located in /tftpboot/Boot.
Linux TFTP server configuration
As linux uses “/” and Windows uses “\” we need to configure the linux tftp server to substitute the slashes in order for it to work.
Firstly you need to edit the /etc/xinetd.d/tftp file to pass an argument to the server.
The existing line will probably be
server_args = -s /tftpboot
this needs to be changed to the following
server_args = -s /tftpboot -m /etc/tftpd.map –vv
Note : The “-vv” at the end is purely for debugging so you can trace what files are downloaded in the linux /var/log/messages file. You can remove this once you are happy everything is all working.
Next you need to create /etc/tftpd.map and put the following lines in it
# Convert backslashes to slashes
rg \\ /
Once you have created the file you need to restart the xinetd daemon typing the following command in as “su”
service xinetd restart
Your tftp server is now ready to use.
DHCP Boot line
On your DHCP server you need to tell it which server and what file the system needs to network boot. Usually for a linux network boot you will have the following two lines in the dhcp description
next-server 143.234.96.47;
filename “pxelinux.0”;
the first line tells the system which server it needs to network boot from , the second line tells it what it needs to boot.
In order to boot the Windows PE environment you need to set the filename to boot as this
filename “\\Boot\\pxeboot.n12”;
This basically tells the system to boot the file from the \Boot folder of your tftp server.