Include a Custom Script in a Windows PE Image

The following procedure demonstrates how to add a customized script to an offline Windows® PE image. Windows PE provides three methods for launching custom scripts: Winpeshl.ini, Startnet.cmd, and Unattend.xml. The Windows PE default interface is a Command Prompt window. However, you can create a customized Winpeshl.ini file to run your own shell application. You can also create your own version of Startnet.cmd to run a specific set of commands, batch files, or scripts.

Before you can add customized scripts, you must first apply or mount the base Windows PE image by using the ImageX tool.

Add a Customized Script Using Winpeshl.ini

You can launch a customized shell application by using a file called Winpeshl.ini. Winpeshl.exe will process the settings in Winpeshl.ini during boot. If you create a customized Winpeshl.ini and require Plug and Play or network support, you must include a call to Wpeinit.exe. Wpeinit.exe specifically installs Plug and Play devices, processes answer file settings, and loads network resources.

Set the AppPath entry to the path to your shell application. The path can either be fully qualified or use environment variables, such as %SYSTEMROOT%\System32\Myshell.exe. The AppPath entry does not support command-line options.

Add Customizations Using Unattend.xml

You can use an answer file with Windows PE to specify various settings and actions. When Windows PE starts, it searches for a file called unattend.xml at the root of any bootable device (for example, a USB flash drive or a floppy disk). You can also specify an unattend.xml file by using Startnet.cmd and Wpeinit.exe.