Preparing WinPE 3.0 for PXE-Boot

This script is based of the scripts provided by the german institution “Regionales Rechenzentrum für Niedersachsen” (R|R|Z|N).
It creates all necessary files in one folder including the boot files in one step.
You just need to upload the folder to your tftproot folder and make a copy of the bootmgr.exe from within the Boot folder to your tftproot folder.
At the end you will get a rudimentary WinPE with a simple Command Prompt.
If you want to have a more advanced WinPE take a look at this article.


Microsoft Windows AIK for Windows 7

This script needs to be run from an administrative Deployment Tools Command Prompt.


@echo off
rem Erstellung von WinPE-Images und Rauskopieren der benoetigten Dateien
rem vgl. Microsoft-TechNet, Walkthrough: Deploy an Image by Using PXE
rem Auszufuehren innerhalb der WAIK-Eingabeaufforderung f. Bereitst.
rem 20090826-HH
Set PXEDest=C:\pxe-tftp
Set OSFolder=Boot
Set x86wim=winpex86.wim
Set x64wim=winpex64.wim
Set createx64=false
if exist %PXEDest% rmdir %PXEDest% /s /q
mkdir %PXEDest%
mkdir %PXEDest%\%OSFolder%
rem Create WinPE-images
if exist %PXEDest%\winpe-x86 rmdir %PXEDest%\winpe-x86 /s /q
call copype.cmd x86 %PXEDest%\winpe-x86
if exist %PXEDest%\winpe-x64 rmdir %PXEDest%\winpe-x64 /s /q
call copype.cmd amd64 %PXEDest%\winpe-x64
rem Dateien architekturunabhaengig, amd64 hat aber zusaetzlich wdsmgfw.efi
imagex /mount %PXEDest%\winpe-x64\winpe.wim 1 %PXEDest%\winpe-x64\mount
xcopy %PXEDest%\winpe-x64\mount\Windows\Boot\PXE\* %PXEDest%\%OSFolder% /s /e
imagex /unmount %PXEDest%\winpe-x64\mount
copy%ProgramFiles%\Windows AIK\Tools\PETools\x86\boot\boot.sdi” %PXEDest%\%OSFolder%
copy %PXEDest%\winpe-x86\winpe.wim %PXEDest%\%OSFolder%\%x86wim%
copy %PXEDest%\%OSFolder%\pxeboot.n12 %PXEDest%\%OSFolder%\pxeboot.0
if%createx64%“==“true” copy %PXEDest%\winpe-x64\winpe.wim %PXEDest%\%OSFolder%\%x64wim%

rem BCD-Erstellung fuer PXE-Boot von WAIK-Windows-7
rem vgl.
rem 20100716-HH
pushd %PXEDest%\%OSFolder%
%systemroot%\system32\bcdedit -createstore BCD
%systemroot%\system32\bcdedit -store BCD -create {ramdiskoptions}
%systemroot%\system32\bcdedit -store BCD -set {ramdiskoptions} ramdisksdidevice boot
%systemroot%\system32\bcdedit -store BCD -set {ramdiskoptions} ramdisksdipath \%OSFolder%\boot.sdi
for /f ” usebackq delims={} tokens=2″ %%i IN (`%systemroot%\system32\bcdedit -store BCD -create /d “WinPE-x86 Boot Image” /application osloader`) do set GUIDx86=%%i
if%createx64%“==“true” for /f ” usebackq delims={} tokens=2″ %%i IN (`%systemroot%\system32\bcdedit -store BCD -create /d “WinPE-x64 Boot Image” /application osloader`) do set GUIDx64=%%i
echo GUID x86: %GUIDx86%
if%createx64%“==“true” echo GUID x64: %GUIDx64%
%systemroot%\system32\bcdedit -store BCD -enum
%systemroot%\system32\bcdedit -store BCD -set {%GUIDx86%} systemroot \Windows
%systemroot%\system32\bcdedit -store BCD -set {%GUIDx86%} detecthal Yes
%systemroot%\system32\bcdedit -store BCD -set {%GUIDx86%} winpe Yes
%systemroot%\system32\bcdedit -store BCD -set {%GUIDx86%} osdevice ramdisk=[boot]\%OSFolder%\%x86wim%
%systemroot%\system32\bcdedit -store BCD -set {%GUIDx86%} device ramdisk=[boot]\%OSFolder%\%x86wim%,{ramdiskoptions}
if%createx64%“==“true” %systemroot%\system32\bcdedit -store BCD -set {%GUIDx64%} systemroot \Windows
if%createx64%“==“true” %systemroot%\system32\bcdedit -store BCD -set {%GUIDx64%} detecthal Yes
if%createx64%“==“true” %systemroot%\system32\bcdedit -store BCD -set {%GUIDx64%} winpe Yes
if%createx64%“==“true” %systemroot%\system32\bcdedit -store BCD -set {%GUIDx64%} osdevice ramdisk=[boot]\%OSFolder%\%x64wim%
if%createx64%“==“true” %systemroot%\system32\bcdedit -store BCD -set {%GUIDx64%} device ramdisk=[boot]\%OSFolder%\%x64wim%,{ramdiskoptions}
%systemroot%\system32\bcdedit -store BCD -create {bootmgr} /d “WinPE BootManager”
%systemroot%\system32\bcdedit -store BCD -timeout 30
%systemroot%\system32\bcdedit -store BCD -default {%GUIDx86%}
if not%createx64%“==“true” %systemroot%\system32\bcdedit -store BCD -displayorder {%GUIDx86%}
if%createx64%“==“true” %systemroot%\system32\bcdedit -store BCD -displayorder {%GUIDx86%} {%GUIDx64%}
goto end
echo Transfer the "%OSFolder%" folder from %PXEDest%\ to the tftp-root folder of your PXE-Server.


PXEDest defines the folder where the script will work in.
OSFolder defines your folder which needs to be uploaded to your PXE-Server.
x86wim and x64wim defines the naming of the wim files you’ll get.
createx64 if set to true will additionally create a rudimentary 64Bit PXE environment.

fundus/winpe30pxe.txt · Zuletzt geändert: 2014/03/10 22:06 von Madic