Navigate back to the homepage

Install Shield Silent Installs

Bulkan Evcimen
November 30th, 2009 · 2 min read

Photo by Kristina Flour on Unsplash

Install Shield has this nifty feature of being able to install packages in silent mode. This means that you can run setup.exe from the command prompt and it will install in the background with no user interaction. This is very useful if you want to test your installation. If you use some sort of continuous integration system (and you should if you don’t) then you could download the latest installer do a silent install and run some tests against the program that is installed, then silent uninstall it all automat(g)ically.

To be able to do silent installs/un-installs you first need to record a response file that contains all the choices for the install shield dialogs.

To record the response file;

setup.exe -r

This will be like a normal install done manually. Follow it through like you would in any normal installation. After the installer exits, the response file should be at C:\Windows\setup.iss

Next time around you can do a silent install by running

setup.exe -s -f1<path to setup.iss>

I’m paranoid so I use the absolute path to the response file. There is no space between “-f1” and the path to setup.iss. Note that, when you run the above command to silent install, the command will seem to exit immediately but if you check Task Manager you should see setup.exe (possibly 2 of them) running.

Silent un-installation is pretty much the same. You need to create a response file first. To do this run the following;

setup.exe -r -uninst -removeonly

This will again create a setup.iss file in C:\Windows I usually rename the uninstall response file as uninst.iss. Now you can do silent uninstallation by running;

setup.exe -s -uninst -removeonly -f1<path to response file>

Some installers might install the program under different GUID’s each time you install it. If this is the case I have found that the above command for uninstallation doesn’t work, as Install Shield doesn’t know what to uninstall. The solution is to work out the UninstallString from the Registry (which is what Windows uses to uninstall the program via Add/Remove Software).

Here is a python script that uses the registry module (https://pypi.python.org/pypi/registry/) to find out the full UninstallString. You first need to manually find this string in your registry by looking under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall so that you can pass into this function a unique string that is present in the UninstallString of your program

EDIT: the following script is quite ugly actually. I have a new version in which I use regobj it makes things easier.

1import registry
2
3def findUninstallStr(q):
4 ''' q: some unique string that appears in the UninstallString value '''
5 uninstallKey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
6 for subkey in registry.GetSubKeys(uninstallKey):
7 for (valuename, value, valuetype) in registry.GetKeyValues("%s\%s" %(uninstallKey, subkey)):
8 if 'UninstallString' == unicode(valuename) and q in unicode(value):
9 uninstallString = value
10 return r"%s" %unicode(uninstallString)

More articles from Bulkan

Experimenting with Python frameworks and modules

Photo by Yasin Arıbuğa on Unsplash I've been very busy since last semester got a new job as a Python (Zope) Developer. Then quitting from my…

September 14th, 2007 · 1 min read

Using Vuejs with Parcel and p5.js

Photo created by grid-art.bulkan.dev This is part two of a two part series. In part one I showed you how you can setup a project using…

August 23rd, 2020 · 1 min read
© 2007–2020 Bulkan
Link to $https://twitter.com/bulkanevcimenLink to $https://github.com/bulkanLink to $https://instagram.com/bulkan.evcimen