Most Windows applications can be installed very easily using the graphical installation assistant by clicking Next-Next-Finish. This always works quite the same way regardless of the software vendor.
Unfortunately the graphical assistant cannot be used for automated silent software installations, as there is no user interaction involved. This means that the information, which is usually gathered via the graphical assistant, has to be passed via the command line. However, this varies largely depending on the underlying installation technology.
During my automation project for Windows environments I got in touch with six different installers. All of them need their own specific parameters for a silent installation. In the following I will describe the different installers, how to identify them, and which parameters are necessary for an automated installation.
Microsoft Installer (MSI)
Microsoft’s preferred installation technology is the so called Windows Installer, formerly known as Microsoft Installer. Usually only few software products are bundled using this installer. This installer can be identified quite easily. A setup file based on this installer is always extended with .msi.
MSI should be called with the following silent install parameters:
msiexec /package installer.msi /qn /LV "C:\logs\myApp.log" TARGETDIR="C:\tools\myApp" INSTALLDIR="C:\tools\myApp"
This example installs the application into C:\tools\myApp and appends a verbose installation protocol to C:\logs\myApp.log.
Since MSI routines tend to ignore the INSTALLDIR parameter in favor of the TARGETDIR parameter, I recommend to pass both using the same value. Be aware, however, that some MSI routines ignore both parameters falling back to their default destination path.
The application can be uninstalled using the silent install parameters again:
msiexec /uninstall installer.msi /qn /lv "C:\logs\myApp-uninstall.log"
Further information about this installer and its silent install parameters can be found on http://msdn.microsoft.com/en-us/library/windows/desktop/aa367988(v=vs.85).aspx.
The embedded MSI-Installer is a setup file with .exe extension. It is a package containing some application files and the MSI installer. To identify this kind of package run the following command in the Windows command line:
findstr /M /C:"by the Windows Installer service" installer.exe
Of course you will have to replace the installer.exe with your own specific setup file. If this command prints one or more results the file might be an embedded MSI installer.
This installer uses the same silent install parameters as the default MSI installer, described above.
Depending on the implementation more silent install parameters are available and documented in the usage help (installer.exe /?).
You can not easily uninstall such applications, because there is no regular MSI file here. They have to be removed differently, e.g. using the uninstall entry from the Windows registry or the WMI service.
Inno Setup is a popular third party installer, which is available for free.
To identify such installer use findstr again:
findstr /M /C:"Inno Setup" installer.exe
Working with this installer you need the following silent install parameters:
installer.exe /VERYSILENT /SP- /LOG="C:\logs\myApp.log" /DIR="C:\tools\myApp"
Since /VERYSILENT is only used to disable installation process output you should also use /SUPPRESSMSGBOXES to suppress decision dialogues by using their default answers. Additionally the silent install parameter /SP- is used to suppress the initial confirmation dialogue.
More information about available silent install parameters can be found on http://www.jrsoftware.org/ishelp/index.php?topic=setupcmdline.
The installer automatically creates an unins000.exe in the install path to uninstall the application. The silent install parameters are valid for silent uninstallation as well.
NSIS (Nullsoft Scriptable Install System)
NSIS is another popular installer.
Identify this installer with:
findstr /M /C:"Nullsoft Install System" installer.exe
Useful silent install parameters for NSIS are:
installer.exe /S /D=C:\tools\myApp
Out-of-the-box this installer doesn’t accept any other silent install parameters than /S and /D. Further information can be found on http://nsis.sourceforge.net/Docs/Chapter4.html#4.12.
NSIS also creates an Uninstall.exe in the install path which can be used for uninstallation together with /S for silent mode.
Install4j is a Java based generator for multiple platforms including Windows.
Identify this installer with:
findstr /M /C:"com.install4j.runtime.installer" installer.exe
Useful silent install parameters for Install4j are:
installer.exe -q -dir C:\tools\myApp
Install4j also accepts other silent install parameters, for example to specify the log path, overwrite existing files, and set custom variables.
See http://resources.ej-technologies.com/install4j/help/doc/helptopics/installers/options.html for a documentation.
SFX (Self Extracting ZIP)
The last and least standardised type of Windows installer is a self extracting ZIP archive. This installer usually can be identified through its icon or its file properties:
Unfortunately this installer type doesn’t accept any default silent install parameters. In my project I often extracted these archives and used the embedded installer which was one of the five listed above.