Windows PE 2.0 Tutorial

Do you want to create a custom boot CD, or run your Windows application in such an environment such as Vista installation, or build a image running like a Vista installation, or re-pack the Vista installation? If so, Windows PE is a good choice.

If you have no idea about Windows PE, please see Windows PE 2.0 for Windows Vista Overview and Windows Preinstallation Environment for more information. Please pay attention on the “Windows PE Limitations” section of Windows PE 2.0 for Windows Vista Overview.

Now, let me build a PE image and set up iSCSI network on PE step by step.

Create a Simple Boot Image

First, install AIK. You can download from the Microsoft official web site: Windows Automated Installation Kit (AIK). AIK is released as an image file, you will need a tool such as a daemon to mount it as a CD. Here, I installed AIK under c:\Program Files\Windows AIK.

Second, you can create a PE image by the steps said on Walkthrough: Create a Custom Windows PE Image if you never have done it. Here, I create a batch file as below, so that I don’t need to keyin the same commands every time.

title Win PE 2.0 Auto-building
@echo off
::------------------------------------------------
:: Variables
::------------------------------------------------
Set PE_FOLDER=c:\vistape
Set VMNETWORK_DRIVERS=c:\VMTools_Driver\vmxnet\*.inf
Set PE_BASIC_FILES=c:\vista_wim_initial
Set AIKTOOL_PATH="c:\Program Files\Windows AIK\Tools\PETools"
  • PE_FOLDER is the path where the PE image will be stored. You don’t need to create this folder; this batch will create it.
  • VMNETWORK_DRIVERS is the path where VMWare network drivers are stored. Because I will run the PE image on a VMWare virtual machine, I have to insert required network drivers of VMWare. To get drivers from VMWare Tools, select [VM/Install VMWare Tools] on the toolbar of VMWare Server Console, and then open the CD-ROM in your guest virtual machine. You will see the drivers on CD-ROM:\program files\VMware\VMware Tools\Drivers. In this case, copy the drivers to c:\VMTools_Driver.
  • PE_BASIC_FILES is the path that stores some windows applications that will run on a PE boot; some others required configurations. It includes two folders: “ISO” and “mount”.
    In the ISO folder: Including peimage.exe that was copied manually; in this case, from c:\Program Files\Windows AIK\Tools\PETools.
    In the mount folder: Nothing is included.
  • AIKTOOL_PATH is the path where AIK was installed.
::------------------------
::Create PE directory
::------------------------

rd /s/q %PE_FOLDER%
c:
cd \
cd %AIKTOOL_PATH%
call copype.cmd x86 %PE_FOLDER%
cd %AIKTOOL_PATH%

::------------------------------------------------
:: Install all required packages and drivers in WIM
::------------------------------------------------

imagex /mountrw %PE_FOLDER%\winpe.wim 1 %PE_FOLDER%\mount

peimg /inf=%VMNETWORK_DRIVERS% %PE_FOLDER%\mount\windows

imagex /unmount %PE_FOLDER%\mount /commit

::------------------------------------------------
:: Create PE bootable image
::------------------------------------------------

del %PE_FOLDER%\ISO\sources\boot.wim
copy %PE_FOLDER%\winpe.wim %PE_FOLDER%\ISO\sources\boot.wim
oscdimg -n -b%PE_FOLDER%\etfsboot.com %PE_FOLDER%\
   iso %PE_FOLDER%\vistape.iso
pause

The above is the required command as said in Walkthrough: Create a Custom Windows PE Image. Where peimg /inf=%VMNETWORK_DRIVERS% %PE_FOLDER%\mount\windows is to import and install VMWare network drivers to the PE image.

Right-clicking the batch file and clicking Run As Administrator, the PE boot image will be created under C:\vistape named vistape.iso. Mount vistape.iso to the CD-ROM of a empty virtual machine; then, start up the virtual machine. You will see that it boots like Vista Installation at the beginning; it then displays a command promty and brings up the network; it needs several minutes. You can type “ipconfig” to find the IP:

You can read How Windows PE Works if you are interested.

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read