What Windows administrator doesn't recognize the letters "msi"? The Windows Installer service (the msiexec.exe program) and its .msi file package component are the de facto technology for Windows application setup. You're probably familiar with the primary benefits of using a Windows Installer application setup package. First, if a problem occurs during setup, the .msi package undoes the part of the installation it performed and rolls backor restoresthe computer to its previous state, thereby avoiding damage to the application or system. Additionally, an .msi-packaged application can repair itself when a user deletes a file from it. Finally, Windows Installer lets you use Group Policy to install software on users' systems. Although you probably know the basics of Windows Installer, a more in-depth knowledge of how Windows Installer and its .msi packages work "under the covers" can help you create custom application setup packages and better troubleshoot application setups. We'll start with a high-level review of the Windows Installer technology, then explore the structure of .msi packages and how they interact with the Windows Installer service.
Windows Installer Technology
Microsoft first shipped the Windows Installer technology about 4 years ago and subsequently made Windows Installer a core part of the Windows 2000 Server OS. Windows Installer 2.0 is included in Windows Server 2003 and Windows XP and includes support for Microsoft .NET assemblies (the unit of installation in .NET). Microsoft makes Windows Installer available in two ways: in the Windows OS as the Windows Installer service and as a software development kit (SDK). The Windows Installer service is the engine that installs Windows Installer packages (i.e., .msi files). The SDK contains specifications and APIs that govern the format and function of .msi files. You can download the Windows Installer SDK, which is part of the Platform SDK, at http://www.microsoft.com/msdownload/platformsdk/sdkupdate/sdkinfo.htm. Developers and vendors of application-packaging tools such as InstallShield Software, OnDemand Software, and Wise Solutions (now part of Altiris) use the SDK to create application setup packages. Developers often use application-packaging tools, which repackage old application setups into the Windows Installer format, to hide from users much of the complexity of the Windows Installer technology.
Products, Features, and Components
An .msi file is a complex database of application-installation instructions that contains dozens of tables, hundreds of columns, and sometimes other embedded files. The database contains information such as OS requirements for installing the application, steps to perform during the installation, and even the dialog boxes to present during setup.
An .msi file comprises a three-part hierarchy. The highest level is the productthe software application itself. A product has a unique product code that's represented as a globally unique identifier (GUID). At the next level are features within the product. Features are referenced by name and represent product functions that a user can choose to install. Figure 1 shows an example of features within an application setupin this case, Microsoft Office Access and Microsoft Office Excel within a Microsoft Office setup. A feature is the unit of installation within a Windows Installer package. That is, when Windows Installer installs a package, Windows Installer installs (or uninstalls) features rather than individual files.
In Figure 1, you can see that Excel has many subfeatures, such as Help and Spreadsheet Templates. For each feature, the user can decide, at installation time, which subfeatures are installed locally on the user's computer or run from a server, which are "advertised" to be installed on the first use (signified by a 1 on the icon for a given subfeature), and which aren't installed at all. (For an explanation of advertisements, see the sidebar "The Power of Advertisements," page 62.)
Features consist of componentsthe third level of the .msi file hierarchy. A component is the basic unit of a Windows Installer package and is the building block of an application. A component can be a file or set of files, a registry setting, a shortcut, or a resource (e.g., icons). A key path is associated with the component. The key path designates the file or setting that must exist for the component to be fully installed. The key path is the basis of the self-repairing nature of Windows Installer-based packages. When Windows Installer repairs an .msi packaged application, the Windows Installer service checks all key paths of all components in the application for completeness. If a key path for a particular component is missing, the Windows Installer service traces the component to the feature it belongs to and reinstalls the feature. Thus, the time needed to repair an installed application depends in part on the number of components in the application package and the number of components that exist within the feature that contains the broken component.
The Windows Installer Database
As I mentioned earlier, an .msi file is a set of setup instructions organized as tables in a database. The Windows Installer SDK defines each table and column. You can use the Orca database editor tool in the Windows Installer SDK to view and edit the contents of an .msi file. The setup .msi file for Orca is in the \bin directory under the Platform SDK installation directory (e.g., c:\program files\platform sdk\bin). After you've installed Orca, you can open any .msi file. When you open a file in Orca, you'll see a list of the file's tables in the left pane of the Orca interface. When you highlight a table, you'll see its rows and columns in the right pane.
Figure 2 shows the LaunchCondition table in the Windows Installer package for Group Policy Management Console (GPMC). In the right pane, the table describes the minimum OS and platform requirements to install GPMC. The Condition column is a set of conditions that must be met during installation. The Description column describes the minimum requirements for the set of conditions. When Windows Installer begins to install the application, Windows Installer determines whether the launch conditions are met before proceeding with the rest of the installation.
Very good explaination of the Windows Installer technology.
DonJuan64 August 04, 2004 (Article Rating: )
An absolutely fabolous overview - I learned so much!
Anonymous User October 25, 2004 (Article Rating: )
necesito el msiexec.exe
Anonymous User November 15, 2004
I gotta say, this is total BS. As a support technician, I am ready to bludgeon the makers of the MSI installer package. It routinely performs half installations and leaves the user stuck with an application that won't work, won't uninstall, and can't be fixed. Even when you try to reinstall the app over the top of the broken one, it will not work. The MSI installer is one of the biggest nightmares on my job because of the horrible design and total lack of thought that went in to it.
Anonymous User November 19, 2004 (Article Rating: )
Thanks for the clarity & intelligence of this article
Anonymous User December 02, 2004 (Article Rating: )
Simply beautiful .... Real good article .. I found it very useful and i learnt so much ...!! Thanks a lot
Anonymous User December 04, 2004 (Article Rating: )
great article. it's a great primer for msi. just what i was looking for. Thank you! msmith
Anonymous User December 16, 2004 (Article Rating: )
Nice article. Been playing with building and deploying packages for over a year and haven't found anything that tells the basics so nicely. I think the self healing .msi technology is great. One thing I found hard to find was for testing purposes using a command line to install packages while logged in as a standard user. I found the runas command and the /jm switches to be invaluable for this. (e.g.
"If you have an .msi file that includes an embedded .cab file, you can use the Windows Installer SDK's msidb.exe tool to extract the .cab file."
How to do that? I have tried with -x option (msidb.exe -x #Data.Cab -d cabinside.msi) but it returns "Stream not found in database". Which is the correct command line to extract an embeded cabinet?
Thanks!
Anonymous User January 18, 2005
Quote: Anonymous User - November 19, 2004 I gotta say, this is total BS. As a support technician, I am ready to bludgeon the makers of the MSI installer package. It routinely performs half installations and leaves the user stuck with an application that won't work, won't uninstall, and can't be fixed. Even when you try to reinstall the app over the top of the broken one, it will not work. The MSI installer is one of the biggest nightmares on my job because of the horrible design and total lack of thought that went in to it. End Quote
You dumb idiot, the fact that you don't know how to handle msi doesn't mean its not well designed!!
It's official: Microsoft's next Windows version, currently being developed under the codename Windows 7 will use that moniker as its official final name when it hits the market in early 2010. The news, delivered as is so often the case these days via a ...
Free Online Event! Virtualization:Get the Facts! Register now and attend this free, live in-depth online conference on November 13 and 20, 2008, produced by Windows IT Pro. All registrants are eligible to receive a complimentary one-year digital subscription to Windows IT Pro (a $49.95 value)!
Ease Your Scripting Pains with the Flexibility of PowerShell! Join MVP Paul Robichaux on December 11, 2008 at 11:00 AM EDT as he equips you with PowerShell basics in 3 introductory lessons, each followed by a live Q&A session—all on your own computer!
Order Your SQL Fundamentals CD Today! Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.
DonJuan64 August 04, 2004 (Article Rating: