Advanced Installer
more / weitere

InstallShield und AdminStudio Schulungen

weitere Infos

InstallShield InstallScript: Uninstallation

Note regarding InstallScript versions: The samples on this page have been developed with various versions of InstallShield. Some of them require a minimum InstallShield version or may only work in the one version they have been created for. Often it will be possible to make them compatible with other InstallShield versions.

See also: 

Avoid Maintenance Mode in IS6

Note: InstallShield Professional 7 has built in support for multiple instances, so the description below does not apply to the new version.

InstallShield enters maintenance mode if an uninstall entry exists in registry at:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{...GUID ...}

There are situations where you don't want your setup to display the Modify/Repair/Remove dialog, e.g. to install an update. Depending on your requirements, there are some options to handle this situation:

Update or Maintenance Mode Depending on Version Number

Take a look at the Update/Maintenance Pack samples that are available at If setup starts in maintenance mode, they compare the version that is currently being installed against the existing version. If they are identical, they show the maintenance GUI. If the version currently being installed is newer, they don't display a setup type or component selection dialog, but simply reinstall.

Remove from Control Panel, Reinstall from Setup.exe

If setup.exe is started by itself, all components are re-installed (repair or update), but if called from the Add/Remove control panel, your application will be uninstalled instead. Uninstallation is handled by passing the UNINSTALL parameter to the setup.exe command line along with the -s for silent execution as shown below:
"\\computer name\share name\folder name\Setup.exe" UNINSTALL -s
A single response file will now handle both installation and uninstallation.

Note that the modifications described here assume that the script was created with InstallShield's Project Wizard.

1. Modify the uninstall string by adding the code shown below at the end of the OnBegin event handler. The code to insert depends on your InstallShield version.

For IS 6.0x, 6.1x and 6.20:

if ( !MAINTENANCE ) then

For IS 6.21 and above:


2. Overwrite the OnMaintUIBefore function entirely with the code below:

    function OnMaintUIBefore()
        SetStatusWindow(0, "");
        StatusUpdate(ON, 100);
        if (CMDLINE % "UNINSTALL") then

3. Overwrite the OnMaintUIAfter function entirely with the code below:

    function OnMaintUIAfter()
        return 0;

4. In the OnFirstUIAfter function replace the line
    szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
   with this code:

    if ((MAINTENANCE) && (CMDLINE % "UNINSTALL")) then
        szMsg1 = "Setup has finished uninstalling %P.";
        szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);

Written by Jim Harding, modified by Stefan Krueger and Betsy Walker
Last update: 2001-02-08

Create Unique Uninstall Entries on the Fly

This extension allows for multiple installations of one product (with identical GUID) onto the same machine. This extension handles the renaming of the GUID directories back and forth between the actual PRODUCT_GUID and the instance GUID. This can't be done from within your setup script, because the uninstall enty can't be renamed while setup is running. Therefore this wrapper was created to perform the renaming.

Usage instructions are included in the package.

ZIP   Written by EONS, Inc.
File size: 35.906 bytes   Last update: 2001-10-03

WWW Documentation about the GUID tool can be found on the EONS homepage

Don't Create an Uninstall Registry

You can abandon maintenance mode at all by deleting or not installing InstallShield's support files and the uninstall registry entry. There will be no entry in the Add/Remove Programs control panel applet. To do this, add the following line to your OnMoving event handler:

    ComponentSelectItem(MEDIA, "Disk<1>", FALSE);

Disk<1> is a invisible component that is automatically added to your media by IS6. This component encapsulate all files that are copied to InstallShield Installation Information\{GUID} folder as well as registry entries associated with uninstallation. You must be aware however that if this component is not installed you won't be able to uninstall the files that setup will transfer. Also if your setup requires a reboot, setup will not resume after the reboot, which means that no self registration will be performed if BATCH_INSTALL=TRUE and the OnRebooted event handler will not be called.

As an alternative, you can add these lines to the OnEnd() event handler:

    if ( !BATCH_INSTALL ) then
        RegDBDeleteKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + PRODUCT_GUID);
        DeleteDir( DISK1TARGET, ALLCONTENTS );

This will delete the uninstall entry at the end of the first time install. If a reboot is required, the support uninstall key and support file will not be deleted, because they are required for post-boot self-registration.

Remove Uninstall Registry Entry When Your Update Installer is Launched

With this method, users can still enter maintenance mode from the Add/Remove control panel, e.g. to uninstall your application. Before your setup runs a second time, use a stub program to delete the uninstall registry entry. To download such a stub program, see: Setup Launcher to Suppress Maintenance Mode in IS6.

Use New GUID for Update Installer

Finally, you can assign a new GUID to your project so that it is seen as a different product by IS6. A new GUID is created if you use the File | New dialog in IDE, go to the Projects tab and select the project you want to use as template. If you copied your project directory with Explorer instead, you can generate a new GUID on your project's properties dialog (requires IS 6.1). To change the GUID from command line, see: Change Project GUID in IS6.

 Adding Components During the Update

If an updated installation has newer components, they will not be added automatically. When reinstallation has been attempted with ComponentReinstall(), any new components would not be installed. To fix this problem, I modified the event handler, OnMaintUIBefore, and added a new function just before the call to ComponentReinstall(). That function is called SelectNewComponents. In that function, the list of top-level components is traversed. Every component is examined to see if it is selected. If it is not, then it is selected, so it will be added to the installation. This solution will probably need to be modified if new subcomponents have been added to the installation. I have never made an installation with subcomponents, so some additional coding will have to be performed to make this solution more robust.
The attached file contains the modified code.

ZIP   Written by Raj Kulkarni
File size: 814 bytes   Last update: 2005-03-26

Additional information:

Generic Uninstall DLL

This package includes a Visual C++ 5.0 project with basic source codes for a custom uninstall DLL. You just fill in the function bodies for UninstInitialize and UninstUninitialize. The DLL also includes the code required to call other uninstall dlls, in case you need to chain multiple of such dlls. Also included is an InstallShield script function to specify the uninstall dll in the uninstall regsitry key.

ZIP   Written by Friedrich Brunzema
File size: 80.556 bytes   Last update: 04/20/1999

Restoring Path During Uninstall

A custom uninstall DLL (written in C) that restores the PATH environment variable to what is was before your setup was executed. Included is the source code and a script file that shows how to use the DLL. Currently, the path that should be removed is hard-coded in the C source code.

This DLL was designed for IS5. See Handle PATH environment on NT for an IS6 solution.

ZIP (5.487 Bytes)   Provided by Taimur Hasan Khan

Modify Uninstall Log File

This sample uses undocumented features of InstallShield 6

In IS6 log is exposed through COM objects that are accessible from script. You can use the log object to modify an existing .ilg file.

Here are two small projects that demonstrate how to do this. (They were created with IS 6.2 - if you have an earlier version, you still can look at the .rul files with a text editor)

  1. LogRegistry has a registry set associated with a file group. All it does is create the registry set. If you uninstall it, it will remove all created keys/values.
  2. FixLog is a project that was created by coping LogRegistry (it has the same project GUID and the same component GUIDs). I removed the registry set from it. It modifies log from script removing entries for top level key created by LogRegistry project. After running FixLog and then uninstalling LogRegistry the top level key won't be uninstalled.

This is a sample. To change it to production project you would have to:

ZIP   From newsgroup installshield.is6.general
File size: 121.964 bytes   Last update: 2000-06-24

Uninstall Previous Version of an Application

This function will extract the uninstall command for the specified application from registry, parse it to separate the full path to the executable from the command line parameters, and launch it with LaunchAppAndWait.

This function is intended to uninstall setups created with IS5 or IS 6 from another setup created with IS5 or IS6. If you want to uninstall an IS 6 setup from another IS 6 setup, you must be using version 6.30 or above. Previous versions did not allow two instances of IS6 running at the same time, at least on some operating systems. For all versions of IS6 an alternative would be to call DoInstall instead.

To uninstall an application that was installed with IS6 pass the product GUID to the function.

prototype UninstallPreviousVersion(STRING);

ZIP   Written by Stefan Krueger
File size: 1.272 bytes   Last update: 2000-03-08




English News Discussions Windows Installer Related Tools More Help InstallScript About InstallSite Shop Site Search
deutsch Neuigkeiten Diskussionsgruppen Windows Installer MSI FAQ Artikel     Shop Suche

Copyright © by InstallSite Stefan Krueger. All rights reserved. Legal information.
Impressum/Imprint Datenschutzerklärung/Privacy Policy
By using this site you agree to the license agreement. Webmaster contact