WinPE 2.1 - much more than a tool -

WinPE 2.1 – much more than a tool


This “Product How-To” article focuses how to use a certain product in an embedded system and is written by a company representative.

Microsoft Windows pre-installation environment provides a complete environment for the management and deployment of the images of Microsoft Windows Embedded operating systems.

The proliferation of low cost products from Asia is leading many European companies to turn to pre-integrated system components in order to be economically competitive and reduce time-to-market. To provide the best possible support for this rapidly and continuously developing trend in the local market, Arrow Electronics has created Arrow Embedded Solutions (AES). This team focuses on integrated solutions such as LCDs, industrial PC boards, Machine-to-Machine (M2M) wireless modules, power packs and embedded operating systems (OSs).

Microsoft is the undisputed market leader for OSs in the desktop environment and has successfully migrated many characteristics of its commercial IT software to the embedded world. Embedded Windows CE, Windows XP Embedded and Windows Embedded for Point of Sales are familiar names to those who operate in the embedded segment. These OSs add the opportunity for personalisation to the advantages offered in the consumer world. Despite this, many of the associated embedded tools are not yet very well known. Among these, the Windows Pre-Installation Environment (WinPE) is a tool which deserves more attention and closer study.

The purpose of this article is therefore to inform the users of Microsoft Embedded systems, and in particular Windows XP Embedded, Windows Embedded Standard, Windows XP Professional and Vista, of the potential of WinPE for the deployment of images generated by the above-mentioned operating systems and for the generation of emergency recovery disks (ERDs).

Discovering WinPE

One of the issues most frequently encountered during customer visits and training courses held by AES is caused by the methods of deployment of the personalised operating system created by our customers. In other words, when the ad hoc operating system crashes, how is it possible to provide the end user with the possibility of repairing the whole system “as new” without resorting to software from third parties for which a royalty has to be paid? What conditions must be met to create an instrument which can be used during production to help install the image created on a large number of machines? What can be done in an operating system that has crashed to recover essential data?

All these questions can be answered very simply: all you need to know is how to use WinPE and the tools accompanying it. In fact, Microsoft has made WinPE 2.1 available for a long time, free of charge on the web, as part of WAIK (the Windows Automated Installation Kit). Right from version 1.0 the purpose of WinPE was to provide a “bootable” support to replace DOS for the management and recovery of operating systems that have been installed or which are to be installed.

However, WinPE 1.0 is not in widespread use, having been distributed exclusively on request through the sales distribution channel. Unlike the previous versions, WinPE 2.1 has introduced improvements in the kernel base, including the ability to personalise language, desktop and drivers for additional peripherals. It has also integrated a tool for the creation, compression and deployment of images of an OS in a file, called Imagex.  All these characteristics make WinPE 2.1 a useful instrument for creating genuine repair discs capable of automated recovery of a system based on factory requirements. All this is available without having to pay additional royalties for operating system licences.

At the heart of WinPE 2.1

The use of WinPE 2.1 is examined in the following in greater detail, focusing attention on its use in generating a Recovery Disk. Two PCs will be used in the description: one called the Engineering PC and the other the Target PC. According to this terminology, the Engineering PC will be that one on which the AIK will be installed and with which the recovery disk will be produced. Consequently the Target PC will be the machine on which an embedded operating system is installed for producing the recovery disk. Having carried out the AIK installation a new menu will be available on the Engineering PC under Programs, called Microsoft Windows AIK. By launching Windows PE Tools Command Prompt a particular command line of DOS is entered which, unlike the standard content of the Accessories menu, supports a large number of commands.

At this point the “copype” command is launched specifying its architecture and destination path (for example copype x86 c:mywinpe ). A copy of everything that can be personalised by WinPE will therefore be found in the destination folder. Since WinPE is based on Imagex, the executable imagex.exe in the folder C:ProgrammiWindows AIKToolsx86 , is copied in the destination  c:mywinpeiso .

On the other hand bootsect.exe is copied from the folder C:ProgrammiWindows AIKToolsPEToolsx86   into the destination c:mywinpeiso . It is then possible to continue the personalisation level of WinPE by installing further packets, a subject which is beyond the scope of this article.

Finally, by launching the command oscdimg -n -bc:mywinpe c:mywinpeISO c:mywinpewinpe_x86. iso ” a bootable WinPE2.1 will be obtained in ISO format, to be mastered on a CD/DVD medium. The process now transfers to the Target PC and booting is carried out by the CD/DVD just produced.

All of WinPE will be loaded in RAM  – see figure 1. A USB-HDD, on which the data file(.wim) of the operating system, is then installed in the Target PC. Starting from this command line of WinPE the image of the operating system installed is captured on the target  machine: imagex /capture c: f:imagestargetimg.wim “DEMOPC“, supposing, of course, that the drive letter from the USB-HDD is f:. Using the various options supplied by the imagex command it is also possible to optimize the captured image by maximizing its compression or speed, and so on.

Fig 1: The WinPE Shell Command

At this point half the work is done: a first version of WinPE2.1 is in fact produced in order to capture the image (targetimg.wim), which has been saved on the USB-HDD. When transferring to the Engineering PC it is necessary to modify WinPE2.1 to generate a Recovery Disk for it.

For this purpose the command line of the AIK is reopened and the following sequence of commands is executed:

>imagex /mountrw c:mywinpewinpe.wim
>copy “C:ProgrammiWindows
>copy “C:ProgrammiWindows

The file startnet.cmd included in the directory windowssystem32 is now modified according to the description in the figure – see figures 2 and 3.

Fig 2: Description of the startnet.cmd file contained in system32.

Fig 3: Description of the script disk-part_script.txt contained in system32.

>imagex /unmount /commit c:mywinpemount
>del c:mywipeisosourcesboot.wim /q
>imagex /export winpe.wim 1
>oscdimg -n c:mywinpeISO

The ISO image thus obtained represents a true recovery disk of the Target PC, which can be redistributed together with the system.

The potential of WinPE is not limited merely to the generation of a recovery disk, although this is one of the points of major interest. In fact, the execution of WinPE using the PXE protocol would make it possible to execute the deployment of an image to a wide Target PC network, thereby facilitating the production process. The distribution and knowledge of the use and potential of this instrument is likely to encourage increasing use of Microsoft Embedded operating systems.

About the author:

Vincenzo Difronzo, is based in Europe with Arrow Embedded Solutions part of Arrow Electronics.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.