What constitutes development
can vary greatly depending upon who you talk to. You could say you
developed an image at this point, so how about developing an automated
way to handle some of the more repetitive tasks of building a Windows PE
image? We saw some solutions that aim to help you do this, but many are
keen to do it themselves. You can do just about anything from a simple
batch file to leveraging the Windows Imaging API (Wimgapi.dll) directly,
both of which are briefly covered in the following sections.
1. Leveraging scripts for automation
A script can be a series of
command lines in a batch file or something more. For example, to have a
script mount an image, import any packages, and then unmount the image,
you need only to create a batch file containing each of the required
commands:
imagex /mountrw c:\winpe_x86\winpe.wim 1 c:\winpe_x86\mount
PeImg /Import=c:\updates\*.cab c:\winpe_x86\mount
PeImg /Install=*KB* c:\winpe_x86\mount
Imagex /Unmount /Commit c:\winpe_x86\mount
You can also write a
script to act on input from the user. Typically user input is provided
to a script by a simple text menu or via command line arguments.
However, today there are tools to let you go far beyond this. One of the
features of the Admin Script Editor provides a GUI editor (see Figure 1)
for creating windows forms for PowerShell (natively using the .NET
Framework) or for VBScript and KiXtart (using the freeware KiXforms COM
component).
NOTE
Admin Script Editor
is a suite of scripting tools designed to help create, manage, and
distribute scripts. A trial of this application may be found on the
included CD and online at www.adminscripteditor.com.
2. Developing solutions with SmartDeploy Imaging Component
The SmartDeploy
Imaging Component (AKA SmartWIM) from SmartDeploy provides a documented
ActiveX control to allow for the incorporation of WIM format support
into your applications or scripts.
Capture and apply disk
volumes directly from script, get information about images through a
Web page, or provide a state-of-the-art user interface complete with
progress bar. SmartWIM eliminates the need to wrap command line tools or
learn Microsoft's provided APIs by offering a straightforward, fully
documented ActiveX control (see Figure 2). Some of the functions and features include:
Capture and apply images using VBScript, Visual Basic, VB.NET, C#
Create delta files that contain only the differences between images
Real-time imaging status with percent complete and estimated time remaining
Single fully self-contained COM object and ActiveX control written with ATL 3.0
Small footprint (~300KB)
Requires no MFC DLLs or runtime libraries
Works on Windows 2000, XP, 2003, Vista, and Windows PE 2.0
Which is the better
tool is a matter of opinion, but keep in mind that the new (and free)
GImageX v2 provides a COM interface for scripting as well.
NOTE
It is possible to utilize the APIs provided by Microsoft directly, although it is more challenging.