Automating Installation
To achieve a fully
automated deployment process, the packages you install must support
unattended installation. Many setup programs support /s or /q command-line options for silent or quiet installations; others don’t.
Often, you can find out whether the package supports unattended installation by typing setup /? at the command prompt, where setup
is the filename of the setup program. If the setup program doesn’t
provide clues, you need to know which vendor’s product was used to
create the package. You can usually tell by running the setup program
and looking for logos, for example, or checking the file properties.
Armed with that information, read the following sections to learn how to
automatically install packages created by different packaging software.
Table 1 summarizes the necessary commands.
Table 1. Unattended Package Installation
Package type | Command for unattended installation |
---|
Windows Installer | msiexec.exe /i package.msi /qn ALLUSERS=2 |
InstallShield Windows Installer | setup.exe /s /v“/qn”
Optionally, you can extract the Windows Installer database from the compressed file, and use the command msiexec.exe /i setup.msi ISSETUPDRIVEN=1 /qn to install it.
|
Legacy InstallShield | setup.exe /s /sms
To create the Setup.iss file necessary to run setup silently, type setup.exe /r
to create a Setup.iss from your responses to the setup program’s dialog
boxes and then copy Setup.iss from %SYSTEMROOT% to the folder
containing the package.
|
Legacy InstallShield PackagefortheWeb | setup.exe /a /s /sms
To create the Setup.iss file necessary to run setup silently, type setup.exe /a /r to create the Setup.iss based on your responses and then copy Setup.iss from %SYSTEMROOT% to the folder containing the package.
|
Legacy Wise Installation System | setup.exe /s |
The following
websites are outstanding resources for automating the installation of
applications, as well as other deployment topics:
AppDeploy.com at
http://www.appdeploy.com This website provides comprehensive information about deploying applications that are packaged using a variety of technologies. SourceForge at
http://unattended.sourceforge.net
This visually nondescript website contains a wealth of information,
including information about automating the installation of many legacy
installers. Real Men Don’t Click at
http://isg.ee.ethz.ch/tools/realmen
Don’t let the name or odd URL detract from this website’s usefulness.
It describes how to automate a variety of processes, including software
installation. InstallShield at
http://www.installshield.com/microsite/packaging%5Febook1/
This webpage contains the e-book “The Administrator Shortcut Guide to
Software Packaging for Desktop Migrations.” This guide is an excellent
resource to learn about packaging applications for deployment.
|
Windows Installer
Windows Installer
is an installation and configuration service that helps reduce
ownership costs by providing a component-based application-installation
architecture. Installation is consistent across all applications
packaged for Windows Installer. Packages are easily customizable,
installations are protected from errors, and a rollback mechanism
provides for recovery in case of failure. Windows Installer supports
application and feature advertising. Windows Installer provides many
other benefits, and most ISVs are now using it to package their
applications. Windows Vista includes Windows Installer 4.0.
Windows Installer 4.0
is compatible with User Account Control (UAC) in Windows Vista. By using
elevated installation, an administrator can authorize Windows Installer
to install applications or patches on behalf of users who aren’t
members of the Administrators group.
Windows Installer packages provide the following to enable flexible application deployment:
Command-line options
You use command-line options to specify options, filenames, and path
names—as well as control the action of the installation at run time.
Properties (variables) on the command line
Properties are variables that Windows Installer uses during an
installation. You can set a subset of these, called public properties,
on the command line.
Transforms
A transform is a collection of changes you can apply to a base Windows
Installer package (.msi) file. You can customize applications by using
Windows Installer transform (.mst) files. You configure transforms to
modify a Windows Installer package to dynamically affect installation
behavior according to your requirements. You associate transforms with a
Windows Installer package at deployment time. Transforms for Windows
Installer package files are similar to answer files that you might have
used to automate the installation of an operating system such as Windows
Vista.
The number of
applications packaged as Windows Installer databases is multiplying
rapidly. Nearly all software vendors are packaging their applications
using this technology. And what often looks like a self-contained,
self-extracting setup program with a filename such as Setup.exe is often
a file that decompresses to a Windows Installer database. You can
usually extract the database by using a tool such as WinZip (from WinZip
Computing at http://www.winzip.com)
or by running the setup program and looking in the %USERPROFILE%\Local
Settings\Temp for the package file. Windows Installer databases have the
.msi file extension.
To install Windows Installer databases unattended using Msiexec.exe, use the /qb command-line option for a basic user interface or the /qn command-line option for no user interface. Also, to ensure that the package installs for all users, add the ALLUSERS=2 property. For example, the command msiexec.exe /i program.msi /qn ALLUSERS=2 installs the package file program.msi with no user interaction and for use by all users who share the computer.
FLEXnet InstallShield
Some Windows Installer databases that Macrovision FLEXnet InstallShield (http://www.installshield.com)
creates require that you install them by running Setup.exe. Trying to
install the .msi file using Msiexec.exe results in a message that you
must run Setup.exe to start the installation. When the developer uses
InstallShield Script, this requirement is enforced to ensure that the
needed version of the InstallShield Script Engine (ISScript.msi) is
installed on the computer before proceeding. If it is not detected, the
required version of InstallShield Script Engine is installed
automatically before starting Windows Installer. You can automate this
installation a couple of ways:
Use
InstallShield’s command-line support that Setup.exe offers. Not only
does Setup.exe provide command-line option support, but you may also
pass options to the Windows Installer setup database by using the /v command-line option. Following /v,
you may specify any options you want to pass to the Windows Installer
setup database within double quotation marks. For example, the following
command installs the application silently and passes the /qn option:
setup.exe /s /v“/qn”
Deploy
the InstallShield Script Engine separately as part of your core
applications before any setup files that require it. You may then safely
bypass running Setup.exe by installing the Windows Installer setup
database with Msiexec and including the ISSETUPDRIVEN
public property. You can extract the embedded Windows Installer setup
database by looking in the %TEMP% folder after the welcome message for
the installation wizard is displayed. Then, use the following command to
install it:
msiexec.exe /i setup.msi ISSETUPDRIVEN=1 /qn
Legacy InstallShield
Packages
created using legacy InstallShield technologies usually have the
filename Setup.exe. To create an unattended installation for a legacy
InstallShield package, you need to create an InstallShield script, which
has the .iss file extension. Many applications come with such a file,
but they’re easy to create otherwise.
To create an InstallShield response file
1. | Run the setup program using the /r
command-line option. This creates a Setup.iss file based on how you
configure the installation as you step through the setup program. The
result is the file Setup.iss in %SYSTEMROOT%.
|
2. | Copy Setup.iss from %SYSTEMROOT% to the folder containing the package.
|
3. | Run the setup program using the /s command-line option. The setup program runs silently using the responses provided by the Setup.iss file.
|
Important
Packages
created by InstallShield will spawn a separate process and then return
immediately to the calling program. This means that the setup program
runs asynchronously, even if you start the setup program using start /wait. You can add the /sms
command-line option to force the setup program to pause until
installation is finished, however, making the process synchronous. |
Legacy InstallShield PackageForTheWeb
PackageForTheWeb
is an InstallShield-packaged application contained in a self-contained,
self-extracting file. You create a Setup.iss file and use it in almost
the same way as in the previous section. The difference is that you must
use the /a
command-line option to pass the command-line options to the setup
program after the file extracts its contents. For example, a file that
you downloaded called Prog.exe
will expand its contents into the temporary folder and then run
Setup.exe when finished. To pass command-line options to Setup.exe, you
must use the /a command-line option. The following procedure demonstrates how this extra option changes the steps.
To create an InstallShield PackageForTheWeb response file
1. | Run the setup program using the /a /r command-line options: setup.exe /a /r.
This creates a Setup.iss file based on the way you configure the
installation as you step through the setup program. The Setup.iss file
is in %SYSTEMROOT%.
|
2. | Copy Setup.iss from %SYSTEMROOT% to the folder containing the package.
|
3. | Run the setup program using the /a /s command-line options: setup.exe /a /s. The setup program runs silently using the responses in the Setup.iss file.
|
Legacy Wise Installation System
Packages created using Wise Installation System (http://www.wise.com) recognize the /s command-line option for unattended installation. No tool is available to script the installation, however.
Windows Script Host
Some
applications cannot be automated with command-line options. These
applications might provide a wizard-based setup routine but require the
user to click buttons or press keys on the keyboard to install the
application. If a user can complete the installation by using only the
keyboard, you can automate the installation by creating a script (a
series of text commands) that simulates keystrokes. This technique is
called screen scraping.
You can screen scrape by using Windows Script Host. Specifically, you use the SendKeys() method to send keystrokes to an application. For more information about the SendKeys() method and an example that you can use to quickly create your own screen-scraping scripts, see http://windowssdk.msdn.microsoft.com/en-us/library/8c6yea83.aspx.
Repackaging Legacy Applications
Some legacy installers
don’t support silent installations, and some that do support silent
installations don’t provide a way to script settings. No legacy
installers provide the management capabilities that Windows Installer
provides.
If you have an
application that is not designed for Windows Installer and does not
support another automated installation technique, you can repackage it
into the Windows Installer setup database so that you can use the
features of Windows Installer to distribute and manage the application. A
repackaged application combines the entire feature set of the
application into a single feature. After repackaging an application, you
use Windows Installer to install it. However, repackaged applications
lack the flexibility to efficiently customize the application
installation.
Caution
Do
not repackage Microsoft Office. The Office package files include logic
that customizes the installation for the destination computer and user.
Repackaging the package file loses this logic, potentially preventing
the package from installing correctly in some configurations. |
The Repackaging Process
Windows
Installer provides no functionality for repackaging applications.
However, numerous vendors sell repackaging products for Windows
Installer. See the next section, “Repackaging Tools,” for a list of vendors.
Repackaging is
not new. Organizations have historically repackaged applications to
customize their installation and configuration. However, Windows
Installer transforms eliminate the need to repackage Windows
Installer–based applications just to customize them. In fact,
repackaging applications that already install from a Windows Installer
setup database is bad practice and not supported.
Repackaging an
application is a process that compares snapshots to determine the
contents of the new package. The following steps provide an overview of
the repackaging process:
1. | Take a snapshot of the computer’s current configuration.
|
2. | Install the application.
|
3. | Take a second snapshot of the computer’s new configuration.
|
4. | Create
a package that contains the differences between the two snapshots. The
repackaging tool detects all differences between the two snapshots,
including all changes to the registry and file system. Since numerous
processes are running in Windows Vista at any time, the package file
will likely contain settings and files related to processes outside of
the application.
|
5. | Clean the package to remove noise (unnecessary files and settings).
|
Caution
Don’t
let the simplicity of these fives steps trick you into believing that
repackaging is easy. Application repackaging is very often the most
expensive part of any deployment project. Once you undertake the
repackaging of an organization’s applications, you can count on a labor-
and resource-intensive effort, particularly in organizations with
thousands of applications, many of which the organization must
repackage. Budget, plan, and schedule accordingly. |
Repackaging Tools
You must use tools not
included with Windows Installer to create Windows Installer packages. A
variety of tools are available, including:
FLEXnet AdminStudio
Available in multiple versions, including a free download, FLEXnet
AdminStudio is a powerful and flexible repackaging tool. The following
versions are available:
FLEXnet AdminStudio SMS Edition This free download from Microsoft integrates with SMS to simplify repackaging. FLEXnet AdminStudio SMS Edition prepares legacy
Setup.exe packages for deployment by converting them to Windows
Installer .msi packages. To download FLEXnet AdminStudio SMS Edition,
see http://www.microsoft.com/smserver/downloads/2003/featurepacks/adminstudio.
AdminStudio Professional Edition
This full version of AdminStudio is a complete solution for packaging,
customizing, testing, and distributing applications. The full version
includes all of the features included with AdminStudio SMS Edition, plus
additional features. To download a trial of AdminStudio Professional
Edition, see the AdminStudio software overview page at http://www.installshield.com/products/adminstudio.
Wise Package Studio Wise offers products for repackaging, testing, and configuring the deployment of applications.
SMS Installer A free, snapshot-based repackaging tool for users of SMS.