3.2. Working with an ImageX GUI
As a command line tool, ImageX can be very easy to automate using scripts . However, if you are performing these tasks
interactively and are not unaccustomed to command line tools and the
many arguments they can require, a graphical user interface can be
desirable. Microsoft provides no such solution, but other companies have
taken it upon themselves to offer such an option:
GImageX
WIM Master
OnDansWIM
Introducing GImageX
GImageX is probably
the most popular solution of those listed here. It has evolved into a
very helpful tool, which began its life as a tool that was written in
the AutoIt
scripting language as a learning tool for those interested in learning
AutoIt. However, it was also offered in the form of a compiled
executable, which made it a valuable tool for those with no interest in
scripting at all.
Taking the fact that
ImageX is a highly scriptable utility to a new level, this script
utilized AutoIt's ability to produce simple Windows Forms to offer an
intuitive interface, so you could avoid the command line entirely. It
included tabs for each of the major functions and text boxes, combo
boxes, and check boxes to specify simple details that were then
translated to command line arguments when calling ImageX behind the
scenes. Because GImageX was essentially a front end to generating ImageX
command lines, it required the imagex.exe utility.
The current release of GImageX takes things forward even further. With the same look (see Figure 2),
installation now requires only that the wimgapi.dll file (from the
WAIK) be stored in the same directory as GImageX (which is provided as a
single executable). This is because GImageX now handles actions
programmatically by using Microsoft's provided API. In fact, the rather
challenging API calls offered by Microsoft can be accessed through a COM
version of GImageX using a well-documented COM interface that can be
leveraged by programs and scripts.
Introducing WIM Master
WIM Master is another
GUI solution for performing ImageX commands using a simple form. Its
layout is almost identical to that of GImageX. This open source tool is
written in Microsoft Visual C++.
Also distributed with the tool and its source code is a BartPE plug-in and a VistaPE script.
WIM Master is available from the discussion thread online at www.boot-land.net/forums/?showtopic=3001
Introduc ing OnDansWIM
You can use another
open source tool, OnDansWIM, which relies on several files distributed
with the WAIK. Looking very similar to that of the tools previously
discussed, it can be used to do everything that the command line ImageX
offers. As you may expect, this is due to the fact that code simply
calls ImageX behind the GUI. In fact, the command line being generated
by the selected options is displayed at the bottom of the display for
debug (and educational) purposes.
OnDansWIM is available at www.msfn.org/board/Imagex-GUI-Open-Source-t99148.html.
3.3. Working with PEImg
PEImg.exe is the
Preinstallation Environment Image Setup tool. It is used to perform any
of several actions upon a mounted Windows PE WIM file (see Table 7).
Keep in mind that for each of these commands you must first mount the
image using ImageX and then provide the path to the Windows directory of
the mounted folder structure (specifically, <mounted
location>\Windows).
In addition to the listed commands, the following flags may also be utilized along with the command:
/verbose: Displays long names for packages (only short names are displayed by default)
/quiet: Suppresses the progress bar
/f: Suppresses prompts (provided for use in scripts, this flag is ignored for operations that would not normally prompt)
Table 7. PEIMG Command Line Options
Command | Purpose |
---|
/Import | Imports a package from a .CAB file or directory structure |
/Install | Installs a specified package into a mounted image |
/List | Displays a list of packages in the current image |
/Uninstall | Uninstalls a previously installed package |
/Inf | Installs an INF package (normally a driver) to a Windows PE image |
/Prep | Optimizes the specified Windows PE image for size |
/Lang | Sets the locale and the UI language of a Windows PE image |
/TimeZone | Sets the default time zone of a Windows PE image |
/TargetPath | Sets the location where the Windows PE image will reside on the disk |
/? | List of command line help |
Using the Import command
The Import command
imports a package from a .CAB file or directory structure. The package
is then available for installation, but must then be installed before it
is available (see the section "Using the Install Command"). To confirm
that an installation has successfully occurred, use the List command to
see if the package is present in the image (and therefore available for
installation).
The syntax for the PeImg Import command is as follows:
PeImg /import=<PackageSource> ImageWinDir [Flags]
The parameters shown here are described in the following list:
PackageSource: The path and filename of a cab file or directory structure to be imported (wildcards are supported) (required).
ImageWinDir: The path to the Windows directory of the mounted image (required).
Flags: Optionally specify /verbose, /quiet or /f (see list at the start of this section for detail).
For example:
peimg /import=c:\updates\*.cab c:\imaging\mount\windows
This example imports all cab files located in the c:\updates directory and imports them into a mounted image located at c:\imaging\mount. Any such packages are then available for installation by using the Install command.
Using the Install command
The Install command is
used to install a package into a mounted image. A list of available
packages and their names can be obtained by using the List command. If
wildcards are used when specifying a package name, any packages with
matching names will be installed.
The syntax for the PeImg Import command is as follows:
PeImg /install=<PackageName> ImageWinDir [Flags]
The parameters shown here are described in the following list:
PackageName:
The name of the package to be installed (see the section "Using the
List Command" for details on how to see what packages are available for
installation)
ImageWinDir: The path to the Windows directory of the mounted image (required)
Flags: Optionally specify /verbose, /quiet or /f (see list at start of this section for detail)
For Example:
peimg /install=*Package* c:\imaging\mount\windows
This example installs all available packages that have a name containing the word "Package" to the mounted image located at c:\imaging\mount.
Using the List command
The List command is used
to display a list of packages available for installation in the current
image. This command can be used to verify that an Import command was
successful or to determine the name of a package you want to install
using the Install command.
The syntax for the PEImg list command is as follows:
PeImg /list ImageWinDir [Flags]
The parameters shown here are described as:
ImageWinDir: The path to the Windows directory of the mounted image (required)
Flags: Optionally specify /verbose, /quiet or /f (see list at start of this section for detail)
For Example:
peimg /list c:\imaging\mount\windows
This example lists all available packages in the mounted image located at c:\imaging\mount.
As shown in Figure 3, the output provides a table with four columns:
Lang: Indicates the language of the package where applicable.
Version: The version number of the listed package.
Ins:
Denotes installation state: a plus (+) indicates a package is
installed, a minus (-) indicates a package is available, but not
installed.
Name: The name of the package (to be specified when using the Install command).
Using the Uninstall command
The Uninstall command is
used to uninstall a previously installed package. A list of installed
packages and their names can be obtained by using the /list command. In
the INS column, (+) denotes installed packages. Wildcards can be used
when specifying a package name. Any packages with matching long names
will be uninstalled.
The syntax for the PeImg Uninstall command is as follows:
Peimg /Uninstall=PackageName ImageWinDir [Flags]
The parameters shown here are described in the following list:
PackageName:
The name of the package to be installed (see the section "Using the
List Command" for details on how to see what packages are available for
installation)
ImageWinDir: The path to the Windows directory of the mounted image (required)
Flags: Optionally specify /verbose, /quiet or /f (see list at start of this section for detail)
For Example:
peimg /uninstall=*Package* c:\imaging\mount\windows
The above example
uninstalls all packages that have a name containing the word Package
from the mounted image located at c:\imaging\mount.
Using the Inf command
The Inf command is used to install an INF package (which is normally used in the installation of drivers) to a Windows PE image.
The syntax for the PeImg Inf command is as follows:
Peimg /inf=<InfFile> ImageWinDir [Flags]
The parameters shown here are described in the following list:
InfFile: The path and filename of the .INF file to be installed
ImageWinDir: The path to the Windows directory of the mounted image (required)
Flags: Optionally specify /verbose, /quiet or /f (see list at start of this section for detail)
NOTE
Like a few of the
cases when a name may be specified as a PEImg value, you may make use of
wildcards in the INF filename to install more than one driver in a
single command.
For Example:
peimg /inf=c:\drivers\*.inf c:\imaging\mount\Windows
This example installs all .INF files from the c:\drivers folder in the mounted image located at c:\imaging\mount.
Using the Prep command
The PEImg Prep
command optimizes the specified Windows PE image for size. If you use
this command, do it last before the image is made available for
production. The reason for this recommendation is that several other
PEImg commands (including install, uninstall, import, and list) will no
longer function after the Prep command is executed. However, the image
is not completely locked; you can still execute the PEImg commands Lang,
Inf, and TargetPath after Prep is executed. Due to the impact this
command has on an image, a prompt is presented to confirm the command,
which can be bypassed for scripting purposes using the /f flag.
The syntax for the PEImg Prep command is as follows:
PeImg /prep ImageWinDir [Flags]
The parameters shown here are described in the following list:
ImageWinDir: The path to the Windows directory of the mounted image (required)
Flags: Optionally specify /verbose, /quiet or /f (see list at start of this section for detail)
For Example:
peimg /prep c:\imaging\mount\windows /f
The above example optimizes the mounted Windows PE image for size with no prompts to confirm the action.
Using the Lang command
Prior to Windows
Vista, Multilingual User Interface (MUI) packs were applied on top of an
English version, and then language packs were installed to provide a
localized user experience. Unfortunately, some languages had more
complete support than others did, and the language packs had to be
installed over an English version of Windows. In Windows Vista, the MUI
architecture separates the language resources for the user interface
from the binaries that make up the operating system. You can now change
languages completely without changing the core binaries of Windows
Vista, or to have multiple languages installed on the same computer.
Languages are applied as language packs containing the resources
required to localize part of, or the entire, user interface in Windows
Vista.
The PEImg Lang command
is used to set the locale and the UI language of a Windows PE image. A
language pack for the specified language must already be installed. The
language to be specified is identified as a culture. A culture is a two-letter identifier used to indicate a language.
NOTE
If you are
creating a Windows distribution (as opposed to Windows PE), you can use
the Intlcfg.exe command line tool to recreate the Lang.ini file and
select the default international values. When adding or removing
language packs in a Windows image, the Lang.ini file must be recreated.
The Lang.ini file is used during Windows Setup and contains a list of
all available language packs, the locations of the language packs, and
the default language to use during Windows Setup.
For example:
intlcfg -genlangini -dist:C:\WindowsFiles -image:C:\imaging\
mount -defaultlang:fr-FR -all:fr-FR
The syntax for the PEImg Lang command is
PeImg /lang=<Culture> [/layerdriver=<ID>] ImageWinDir [Flags]
The parameters shown here are described in the following list:
Culture: The culture name of the specified language (for example en-US, nl-NL, ja-JP or any of the available cultures provided).
ID:
For some cultures, this may be used to specify a numeric value that may
be used to indicate which keyboard layer driver should be installed.
Specifically, the ja-JP or ko-KR cultures support values between 1 and
6.
ImageWinDir: The path to the Windows directory of the mounted image (required).
Flags: Optionally specify /verbose, /quiet or /f (see list at start of this section for detail).
For example:
peimg /lang=en-us c:\imaging\mount\windows
In the above example, the English language is applied to the mounted image located at c:\imaging\mount.
Using the TimeZone command
The PEImg TimeZone
command is used to set the default time zone of a Windows PE image. This
command can only be performed against an image that has previously been
prepared by using the Prep command. The default English time zone is
set to Pacific Standard Time. To view the current time zone of an image,
use the PEImg List command.
The syntax for the PEImg TimeZone command is as follows:
PeImg /timezone=Culture =>
TimeZoneName ImageWinDir [Flags]
The parameters shown here are described as:
Culture or TimeZoneName: Either the culture or the time zone name reflecting the desired time zone (required)
ImageWinDir: The path to the Windows directory of the mounted image (required)
Flags: Optionally specify /verbose, /quiet or /f (see list at start of this section for detail)
For Example:
peimg /timezone="Eastern Standard Time" c:\imaging\mount\Windows
This example sets the image located at c:\imaging\mount to the Eastern (EST) time zone.
Using the TargetPath command
The TargetPath
command sets the location where the Windows PE image will reside on the
disk (for hard drive boot scenarios). This path must be specified as the
root or a subdirectory of drive X. This command can only be executed
against a Windows PE image that was previously prepared by using the
Prep command.
The syntax for the PEImg TargetPath command is
PeImg /targetpath=<DriveX> ImageWinDir [Flags]
The parameters shown here are described in the following list:
DriveX:
Specifies the location where Windows PE should be applied on a hard
drive. This value must be either X: or a subdirectory of drive X
(required).
ImageWinDir: The path to the Windows directory of the mounted image (required).
Flags: Optionally specify /verbose, /quiet or /f (see list at start of this section for detail).
For example:
peimg /timezone="Eastern Standard Time" c:\imaging\mount\Windows
This example sets the image located at c:\imaging\mount to the Eastern (EST) time zone.