Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

How to create your own MSI file to deploy applications

Using Group Policy settings to deploy applications throughout your organization works well if the app you're deploying includes an installation package in MSI format. But it if doesn't, try creating your own MSI file.

Recently, I explained how to use Group Policy settings to deploy applications throughout your organization. The...

process works well if the application you are deploying includes an installation package in MSI or ZAP format. This is fine if you are deploying a Microsoft application, but not all companies include MSI files with their software. (I don't recommend using ZAP files because of the restrictions they place on the installation process.)

So what's an administrator to do?  Easy -- build your own! Creating an MSI file isn't as difficult as you might think.

An MSI file is a Windows Installer Package. Why do you need it? Why can't SETUP.EXE get the job done by itself? An MSI file's job is to help SETUP.EXE by providing it with information such as which folder the application should be installed to, which of the application's optional components should be installed and which Registry keys need to be added to the system or modified. An MSI file stores this information in database format.

I take a hands-on approach to the techniques I explain, and like to demonstrate how to perform a specific task step by step. But demonstrating the process for creating an MSI file in a step-by-step manner is difficult because Windows does not contain a utility for building MSI files. You have to rely on third-party software.

Furthermore, I'm leery of explaining this process because almost all of the dozens of MSI creation utilities work differently. As such, there is no "proper" way of creating an MSI file unless, of course, you want to download the Microsoft Windows Installer SDK and code your own installer.

Usually I like the idea of writing my own code but, in this case, it may not be the best idea. Coding a custom installer package is fine for applications that are developed in-house, but it could be very difficult for commercial applications shipped without an installer package. For such applications, I recommend using one of these authoring utilities.

Over the years, I've built some MSI files of my own so I could deploy legacy applications through Group Policy settings. Some MSI creation utilities are suited to developers and others to administrators. Which one you choose depends on what you need your MSI package to do (i.e., do you need fancy Flash-based animation?) and your budget. A simple-to-use utility called WinInstall LE is priced around $50.

Like some other MSI creation utilities geared toward administrators, WinInstall LE relies on a technique called diffing. Diffing allows you to compare one system with the application and one without the application for which you are going to create the MSI file. The utility then uses the detected differences to build an MSI file.

That's the Readers' Digest version. In real life, it's a bit more complicated than that -- but not much. The way I described how diffing works is absolutely true, but you have to make sure that nothing on the system has changed other than the addition of the application you are creating the MSI file for.

The easiest way to accomplish that is to set up a computer with a clean installation of Windows. (It can be a real or a virtual machine.) Once you have a clean installation, I recommend using a product such as Norton Ghost to make an image of the hard drive. You can use this image file the next time you have to make an MSI file for another product instead of having to install Windows from scratch.

Once you have a clean Windows installation and you have imaged the hard drive, use the MSI creation utility to take a snapshot of the hard disk. This is different from the image you made earlier; you use that one to return the machine to a pristine state once you're done so that you can create an MSI file for a different product. You will use the snapshot you create with the MSI creation software in the diffing process.

After you take a snapshot of the PC's hard drive, install the application you are building the MSI file for. Then, simply use the MSI creation software to take a second snapshot. The software will compare the snapshots and use the differences between them to build an MSI file for you. It doesn't get any easier than that!

As simple as the MSI file creation process can be, I have a couple of tricks that help make the process run a bit more smoothly:

  • Make sure the machine you are using to build the MSI file is running the same version of Windows. In addition, use the same service pack level as the machines that the application you are building the MSI file for will eventually be installed on. This isn't critical but, for me, the service pack level made a difference in a couple of instances.
  • Sometimes (emphasis on the word sometimes) you can get away with creating an MSI file for a bundle of applications. If you have two or three applications that you plan to install on all of the workstations, you can sometimes get away with creating your first snapshot and then installing all of the applications before you create your second snapshot. This causes the utility to create a single MSI file that you can use to deploy multiple applications. It doesn't always work, but if it does, it's a huge time saver, so it's worth a try.

You can follow SearchWindowsServer.com on Twitter @WindowsTT.

Brien M. Posey, MCSE, is a Microsoft Most Valuable Professional for his work with Windows 2000 Server and IIS. He has served as CIO for a nationwide chain of hospitals and was once in charge of IT security for Fort Knox. He writes regularly for SearchWinSystems.com and other TechTarget sites and has also written for Microsoft, CNET, ZDNet, MSD2D, Relevant Technologies and others.

More information from SearchWindowsServer.com

Dig Deeper on Windows systems and network management