A bit late(ok,very late!), WinPE got my attention. WinPE is a subset of a Microsoft based OS, in it’s
current version (2.0)-Vista.
At it’s essence, WinPE is a stripped down version of Vista that enables you to boot a system
to an OS that is not installed on the system but still be able to manipulate this system. The OS
itself (WinPE) will be “installed/saved” on either a network, a CD or some type of flash drive.
Once started,WinPE loads into run and it provides you with a Vista like environment, to do one
of the following:
- Troubleshoot– a crippled system.
- Install Vista – More about this in a later post.
- Data access – Copy information from the system.
So, as mentioned, WinPE is actually an OS (one that comes free with Vista), why shouldn’t it be
used on a daily basis? Well for starters this OS provides very limited functionality and this becomes
very obvious when you start it-your shell is cmd.exe. Yet fear not,I hope to show you in this post
how to modify WinPE to make it more usable.
Another limitation imposed on WinPE is that it will restart every 24 hours,other then that trust me,
you wouldn’t want to use it as an OS…
Part 1 – Creating WinPE
The creation of a basic WinPE medium is relatively straightforward. Use the following instructions to create it:
- Download the latest version of Windows Automated Installation Kit (AIK).
- Install it…
- Go to Start > All Programs > Microsoft Windows AIK > Windows PE Tools Command Prompt
- Use copype.cmd to create the WinPE environment by copying the files for the correct platform:
copype <x86|AMD64> <destination folder>
- Note that at this stage we could go and complete creating WinPE yet we would end up with a very
basic OS with no additional tools (or in the words it would be cool but it wouldn’t be useful).
Part 2 -Customizing WinPE: Adding tools
The simplest way to customize WinPE is to copy the files of the tools you want to use into the WinPE
image. To be able to so so you need to mount the Windows Imaging format (WIM) image of what you created
in stage 1 (more on this in a later post) then copy the files.
Use the following instructions:
- We will be using imageX to mount the image (prepare a directory into which you will mount the image):
imagex /mountrw e:\winpe_x86\winpe.wim 1 e:\mount
- Copy the files you need to a directory in the mounted image.
[I created a folder called ‘Tools’ under the ‘Windows’ directory.]
- Among the tools I copy are:
- imageX – c:\Program Files\Windows AIK\Tools\x86
- imageX GUI- If you are into a GUI(which I am), download it at(don’t forget to copy wimgpai.dll):http://www.autoitscript.com/gimagex/
- A good file manager- a43 is my favorite, download it at: http://www.primitus.us/a43/
- A bunch of Sysinternal tools- cause I like them
- A GUI based disk partitioning tool – On other hand keep in mind that you can use DISKPART and FORMAT
- In addition to copying tools, you should also install the WinPE packages using the following command:
peimg /install=<pkg> <image directory>
- To View the available packages use the following command:
peimg /list <image directory>
- The ‘Ins’ column shows if the package is installed or not. As you can see none of the packages are installed
so it’s time to start installing.
- Please note that the Windows Recovery Environment component package was dropped. There are workarounds
to install it, yet since it can be started by more conventional methods I do not cover them.
Part 3 -Customizing WinPE: Adding an alternative shell
In my opinion the most uncomfortable pare of WinPe is the lack of a standard (menu based) shell. I mean we are Microsofties,
we love GUI!
To enable the usage of a more standard shell use the following instructions:
- Download an alternate shell for WinPE such as NU2Menu.
- Copy it to a directory inside the image.
[I copied it to \Windows\NUShell]
- Customizing the NU2Menu is independent from WinPE and you can find the instruction on the aforementioned web
site. The configuration is based on an XML file which is very intuitive. I will provide my configuration as an example:
- After you are happy with the layout and configuration you need to configure WinPE to use the alternative shell. This is done by creating a text file withe the following layout:
AppPath = %SYSTEMDRIVE%\myshell.exe
%SYSTEMDRIVE%\mydir\application1.exe, -option1 -option2
application2.exe, -option1 -option2
Part 3 – Controlling WinPE: Controlling the environment with WPEUTIL
The command that will enable control of the environment is WPEUTIIL. WPEUTIL has several
arguments that control different aspects of the environment. The commands can be integrated
into the startup script or the shell menu. These are the arguments that can be used:
CreatePageFile [/path=<path>] [/size=<size>]
Creates a page file to a specified path and size. You must specify at least one argument, path or size. For example, wpeutil CreatePageFile /path=C:\pagefile.sys.
Disables firewall. Does not require any arguments.
Enables firewall. Does not require any arguments.
Initializes network components and drivers, and sets the computer name to a randomly-chosen value.
Lists the supported keyboard layouts (Name and ID) for a given Locale ID (LCID) value. For a list of valid Locale IDs, see List of Locale ID (LCID) Values . For example,
wpeutil ListKeyboardLayouts 0x0409
wpeutil ListKeyboardLayouts 1033
Restarts the current Windows PE session.
SetKeyboardLayout <keyboard layout ID>
Sets the keyboard layout in the current Windows PE session. To obtain a list of supported keyboard layouts, run ListKeyboardLayouts <LCID>. To set the keyboard for EN-US, use
wpeutil SetKeyboardLayout 0409:00000409
Sets the language. <language-name> uses the international language code format (for example, EN-US for the U.S. English). You can specify multiple languages in priority order by separating them with a semicolon. For example,
wpeutil SetMuiLanguage de-DE;en-US
Sets the user locale. <language-name> uses the international language code format (for example, EN-US for U.S. English). You can specify multiple languages in priority order by separating them with a semicolon. For example,
wpeutil SetUserLocale de-DE;en-US
Shuts down the current Windows PE session.
Updates information about the method used to boot Windows PE. Information is stored in the registry in the key HKLM\SYSTEM\CurrentControlSet\Control. The results of this operation might change after loading additional driver support.
Part 4 – Customizing WinPE: Cosmetic Changes
- If you need to run a command at startup use the ‘startnet.cmd’ batch located at e:\mount\windows\system32.
- If you want to change the background look for a file called ‘winpe.bmp’ located in the
system32 folder of the WinPE environment.
Part 5 – Closing the image
To close the image you need to finalize it, unmount it, copy it over the current boot.wim and then create the ISO image.
Use the following instructions:
- Unmount the image using the following command:
imagex /unmount e:\mount /commit
- Copy the current image to the boot image:
copy e:\winpe_x86\winpe.wim e:\winpe_x86\ISO\sources\boot.wim
- Create the ISO image:
oscdimg -n -be:\winpe_x86\etfsboot.com e:\winpe_x86\ISO e:\winpe_x86.iso
- Burn the image or create a flash based device.
WinPe will provide you with a relatively comfortable environment to troubleshoot a failed installation of Windows.
In essence, WinPE as an operating system that, one that you can customize and configure according to your needs:
you can use it as a deployment tool a recovery platform or anything else you can think about.
In this post, I have tried to demonstrate the relative ease in which you can customize WinPE. The process of customizing
WinPE is not simple, yet with some trial and error you can build your own system and use it in time of need. There are
two alternatives for manually building the WinPE environment (that I can think of) that you might want to consider:
VistaPE – http://www.vistape.net/vistape.html
BartPE – http://www.nu2.nu/pebuilder/
Both of these tools automate the process, nevertheless I prefer the manual method as you get acquainted with environment,
so try it and start experimenting…In a few future posts I will try to put WinPE to work by deploying images using it.