---
title: "Preparing WinPE 3.0 for PXE-Boot"
id: "172"
type: "post"
slug: "winpe30pxe"
published_at: "2014-03-10T21:06:58+00:00"
modified_at: "2025-05-20T06:11:12+00:00"
url: "https://www.geekbundle.org/winpe30pxe/"
markdown_url: "https://www.geekbundle.org/winpe30pxe.md"
excerpt: "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"
taxonomy_category:
  - "Sonstiges"
taxonomy_post_tag:
  - "bartpe"
  - "pxe"
  - "windows pe"
  - "winpe"
  - "winpe30"
---

Table of Contents

This script is based of the scripts provided by the german institution [“Regionales Rechenzentrum für Niedersachsen” (R|R|Z|N)](http://www.rrzn.uni-hannover.de/anl-waikpxe.html)
.

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](https://www.geekbundle.org/creating_winpe30/)
.

## Pre-Requirements

[Microsoft Windows AIK for Windows 7](http://www.microsoft.com/downloads/details.aspx?familyid=696DD665-9F76-4177-A811-39C26D3B3B34)
  
 This script needs to be run from an administrative Deployment Tools Command Prompt.

## Script

 [bash]@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-x64winpe.wim 1 %PXEDest%winpe-x64mount  
 xcopy %PXEDest%winpe-x64mountWindowsBootPXE* %PXEDest%%OSFolder% /s /e  
 imagex /unmount %PXEDest%winpe-x64mount  
 copy “%ProgramFiles%Windows AIKToolsPEToolsx86bootboot.sdi” %PXEDest%%OSFolder%  
 copy %PXEDest%winpe-x86winpe.wim %PXEDest%%OSFolder%%x86wim%  
 copy %PXEDest%%OSFolder%pxeboot.n12 %PXEDest%%OSFolder%pxeboot.0  
 if “%createx64%“==“true” copy %PXEDest%winpe-x64winpe.wim %PXEDest%%OSFolder%%x64wim%

rem BCD-Erstellung fuer PXE-Boot von WAIK-Windows-7  
 rem vgl. http://www.rrzn.uni-hannover.de/anl-waikpxe.html  
 rem 20100716-HH  
 pushd %PXEDest%%OSFolder%  
 %systemroot%system32bcdedit -createstore BCD  
 %systemroot%system32bcdedit -store BCD -create {ramdiskoptions}  
 %systemroot%system32bcdedit -store BCD -set {ramdiskoptions} ramdisksdidevice boot  
 %systemroot%system32bcdedit -store BCD -set {ramdiskoptions} ramdisksdipath %OSFolder%boot.sdi  
 for /f ” usebackq delims={} tokens=2″ %%i IN (`%systemroot%system32bcdedit -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%system32bcdedit -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%system32bcdedit -store BCD -enum  
 echo.  
 %systemroot%system32bcdedit -store BCD -set {%GUIDx86%} systemroot Windows  
 %systemroot%system32bcdedit -store BCD -set {%GUIDx86%} detecthal Yes  
 %systemroot%system32bcdedit -store BCD -set {%GUIDx86%} winpe Yes  
 %systemroot%system32bcdedit -store BCD -set {%GUIDx86%} osdevice ramdisk=[boot]%OSFolder%%x86wim%  
 %systemroot%system32bcdedit -store BCD -set {%GUIDx86%} device ramdisk=[boot]%OSFolder%%x86wim%,{ramdiskoptions}  
 if “%createx64%“==“true” %systemroot%system32bcdedit -store BCD -set {%GUIDx64%} systemroot Windows  
 if “%createx64%“==“true” %systemroot%system32bcdedit -store BCD -set {%GUIDx64%} detecthal Yes  
 if “%createx64%“==“true” %systemroot%system32bcdedit -store BCD -set {%GUIDx64%} winpe Yes  
 if “%createx64%“==“true” %systemroot%system32bcdedit -store BCD -set {%GUIDx64%} osdevice ramdisk=[boot]%OSFolder%%x64wim%  
 if “%createx64%“==“true” %systemroot%system32bcdedit -store BCD -set {%GUIDx64%} device ramdisk=[boot]%OSFolder%%x64wim%,{ramdiskoptions}  
 %systemroot%system32bcdedit -store BCD -create {bootmgr} /d “WinPE BootManager”  
 %systemroot%system32bcdedit -store BCD -timeout 30  
 %systemroot%system32bcdedit -store BCD -default {%GUIDx86%}  
 if not “%createx64%“==“true” %systemroot%system32bcdedit -store BCD -displayorder {%GUIDx86%}  
 if “%createx64%“==“true” %systemroot%system32bcdedit -store BCD -displayorder {%GUIDx86%} {%GUIDx64%}  
 popd  
 goto end

:end  
 echo.  
 echo.  
 echo.  
 echo Transfer the "%OSFolder%" folder from %PXEDest% to the tftp-root folder of your PXE-Server.  
 pause[/bash]

## Explanations

`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

**Ähnliche Beiträge**- [Creating a WinPE 3.0](https://www.geekbundle.org/creating_winpe30/)
- [Schneller neustarten mit kexec](https://www.geekbundle.org/schneller-neustarten-mit-kexec/)
- [Zugriff auf veraltete IPMI Web Konsolen](https://www.geekbundle.org/zugriff-auf-veraltete-ipmi-web-konsolen/)
- [Certificate Signing Request für eine Windows CA mit…](https://www.geekbundle.org/certificate-signing-request-fuer-eine-windows-ca-mit-openssl-erstellen/)

### Kommentar hinterlassen [Antwort abbrechen](/winpe30pxe/#respond)
