Monday, February 7, 2011

Automate Software Installation. Silently, Unattended And in Bulk

gears2The Windows software install process is a pain in the ass. It is one thing that hasn’t changed for nearly two decades. The repeated clicking of the ‘Next’ button, the agreeing of the EULA that nobody reads, the checking/unchecking of boxes - all requires you to sit through the entire process, for every single program you install.

Projects such as Ninite and TGUP (The Great Unattended Project) provides some comfort by allowing you to install (and even download) several software at once. But they have limitations too – you can install only those software they support, and the support is limited and often restricted to only free and open source programs.

Windows Post-Install Wizard is another program that lets you automate the initial configuration and customization every user invariably goes through after every fresh Windows installation. This includes applying tweaks, turning on and off services, registry tweaking and of course, unattended software installs.

This tutorial will show you a different and simpler way to create silent installers of multiple software programs and automate their installation, without user intervention. I encourage you to explore each of the different methods and programs I mentioned in the previous paragraphs, including the one below, and see which suits you best.

Step 1: Find Silent Switches of Installers

Most installers or setup programs have hidden command line switches which can be used to bypass all those confirmation message boxes you have to click during a typical install process. Some software developer will include the command line switches in its documentation but many do not. So we have to sniff out these hidden switches from the installer. To do that we will use a really old program called Universal Silent Switch Finder (direct download link).

Run the program, select the program setup file and it immediately shows all switches that the setup accepts. In this screenshot, I used the installer of CDBurner XP.

silent-switch-finder

Copy the silent switches to the clipboard.

Step 2: Create Batch Script With AutoIT

The next step is to create a batch script that will execute the installer with the silent switches applied. For this I chose a scripting language called AutoIt. It is a BASIC-like scripting language that is very easy to use and can be used to simulate keystrokes and mouse movement, and can interact with the Windows GUI that makes it extremely useful for automation tasks.

Download and install the AutoIt Script Editor, SciTE.

In our automation script we will be using the command Runwait. Runwait executes the requested program and pauses script execution until the program finishes. This way we can queue several installers to run one after the other.

To begin, launch SciTE and type the following:

RunWait("cdbxp_setup.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-")

The switches I got from Universal Silent Switch Finder. To add multiple installer programs you just add multiple RunWait commands. End your script with Exit.

scite-editor

Save the scipt (.au3 extension). Then click on Tools > Compile in the editor. This will create an .exe version of your script that you can run on any machine without having AutoIT installed.

Move the compiled EXE script to the same folder where the installers are located, and run it. If you did everything right, your programs should be installed in sequence. You won’t see anything though since we have suppressed all message boxes through the switches. The only thing you will notice is a busy cursor. It is best to leave the computer until it completes the entire installation. Once it’s over, check your start menu and you should see the programs listed.

I Cannot Find Silent Switches For My Program

This is one problem with Universal Silent Switch Finder. It cannot find silent switches for all programs, usually the ones that uses custom build setup packages. For example, it does not work for Firefox, Opera or Skype.

If Universal Silent Switch Finder fails to find silent switches for your program, you can checkout this MSFN forum thread. It has a fairly large list of user contributed switches for popular software installers. You can also search on the discussion board for your program, or Google it.

If a Google search draws blank, the next possible option is to identify the installer system that the program uses. There are several systems which vendors use to create installers for their applications. If you can identify which installer package was used to create the program setup, you can make an educated guess about what switches to use. Sometimes this will be obvious from the installer's splash screen and sometimes you will have to guess.

This page over at Sourgeforge explains the various switches different installer packages use and how to discover switch by running strings. This guide is your last resort.

1 comment:

Popular Posts