WindowsPE – Charting a new environment

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:

  1. Troubleshoot– a crippled system.
  2. Install Vista – More about this in a later post.
  3. 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…

image 
    The standard WinPE 2.0 UI

 

Part 1 – Creating WinPE

The creation of a basic WinPE medium is relatively straightforward. Use the following instructions to create it:

  1. Download the latest version of Windows Automated Installation Kit (AIK).
  2. Install it…
  3. Go to Start > All Programs > Microsoft Windows AIK > Windows PE Tools Command Prompt
    image
  4. Use copype.cmd to create the WinPE environment by copying the files for the correct platform:
    copype <x86|AMD64> <destination folder>
    image
  5. 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:

  1. 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
    image
  2. Copy the files you need to a directory in the mounted image.
    [I created a folder called ‘Tools’ under the ‘Windows’ directory.]
  3. Among the tools I copy are:
    1. imageX – c:\Program Files\Windows AIK\Tools\x86
    2. 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/
    3. A good file manager- a43 is my favorite, download it at: http://www.primitus.us/a43/
    4. A bunch of Sysinternal tools- cause I like them
    5. A GUI based disk partitioning tool – On other hand keep in mind that you can use DISKPART and FORMAT
      image
  4. In addition to copying tools, you should also install the WinPE packages using the following command:
    peimg /install=<pkg> <image directory>
  5. To View the available packages use the following command:
    peimg /list <image directory>
    image 
  6. 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.
    image
  7. 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:

  1. Download an alternate shell for WinPE such as NU2Menu.
  2. Copy it to a directory inside the image.
    [I copied it to \Windows\NUShell]
  3. 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:
    image image
  4. 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:
    [LaunchApp]
    AppPath = %SYSTEMDRIVE%\myshell.exe
    [LaunchApps]
    %SYSTEMDRIVE%\mydir\application1.exe, -option1 -option2
    application2.exe, -option1 -option2
    image

 

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.

DisableFirewall

Disables firewall. Does not require any arguments.

EnableFirewall

Enables firewall. Does not require any arguments.

InitializeNetwork

Initializes network components and drivers, and sets the computer name to a randomly-chosen value.

ListKeyboardLayout <LCID>

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

Or

wpeutil ListKeyboardLayouts 1033

Reboot

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

SetMuiLanguage <language-name>[;<language-name>]

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

SetUserLocale <language-name>[;<language-name>]

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

Shutdown

Shuts down the current Windows PE session.

UpdateBootInfo

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

  1. If you need to run a command at startup use the ‘startnet.cmd’ batch located at e:\mount\windows\system32.
  2. 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:

  1. Unmount the image using the following command:
    imagex /unmount e:\mount /commit
    image
  2. Copy the current image to the boot image:
    copy e:\winpe_x86\winpe.wim e:\winpe_x86\ISO\sources\boot.wim
  3. Create the ISO image:
    oscdimg -n -be:\winpe_x86\etfsboot.com e:\winpe_x86\ISO e:\winpe_x86.iso
  4. Burn the image or create a flash based device.

 

Conclusions

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.

image

5 thoughts on “WindowsPE – Charting a new environment

  1. I followed you all the way until it came time to create a file to configure WinPE to use the alternative shell but you do not tell me what to call this file and where to put it. This is a steep hill for me but it is interesting for me. Please bear in mind that I am a bit of a newbie at this. Thanks

  2. Some time ago, I really needed to buy a good car for my firm but I didn’t earn enough money and could not order anything. Thank heaven my sister adviced to take the home loans at reliable creditors. Thence, I acted so and was happy with my term loan.

Leave a Reply to YOLANDAMeyers Cancel reply

Your email address will not be published. Required fields are marked *