user3829915
user3829915

Reputation: 45

InstallScript - Overwrite the default uninstaller?

Our company uses Flexera InstallShield 2012 (old, I know), and I am currently creating an InstallScript project. Everything is running nicely, the script does exactly what I want it to do.

However, I am currently in a pickle. InstallScript has the OnUninstall built-in function that gets called when the Setup is being run with the -uninstall flag. I have written my custom uninstall script to remove everything I install during the setup.

But apparently InstallScript (or the Windows Installer) creates a different uninstaller for when you go to Programs and Functions -> Uninstall in the Windows Control Panel.

Is there any way to manipulate this "default uninstaller" with InstallScript?

If you need more information please comment and I will update this post.

Thank you!

Upvotes: 2

Views: 601

Answers (2)

Stein Åsmul
Stein Åsmul

Reputation: 42136

If this is an Installscript MSI project then it has its own Windows Installer uninstall implicitly included in the MSI itself.

In theory, depending on how you have done things, there should be little to no need to implement custom uninstall logic yourself - unless you are doing something very unusual.

All files and registry entries added with MSI components should be uninstalled properly, unless other MSI files have them registered in use, or you have set the component to be permanent or shared with legacy installer component referencing by updating and heeding the use count here:

  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs
  • HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SharedDLLs

(meaning that the old-style reference counting from legacy installers will be respected - the resource is not uninstalled if a legacy installer has the file registered in use).

What are you doing in your Uninstall event handler?

Upvotes: 0

Slava Ivanov
Slava Ivanov

Reputation: 6912

I can see two options available for you to try ...

  1. As you mention correctly OnUninstall called when the installation is run with the -uninst parameter. I suspect this parameter is missing from the Windows registry entry. Please have a look at ...

    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{your_product_id}\UninstallString
    

    The key should have string to run setup in uninstall mode with -uninst parameter in order for setup to hit OnUninstall handler. If it's not set, you may need to add it manually at the time of initial registration of your product.

  2. You may use OnEnd event handler, which designed to make cleanup at the end of installation and would hit all the time. Inside this event handler you may do specific scripting for your product removal. The code may look like ...

    function OnEnd()
        // local variables
    begin
        if (!MAINTENANCE) then
            // initial setup; you may fix the Windows uninstall registry here (see point #1)
        else
            if ( nMaintTypeGlobal = REMOVEALL ) then
                // product removal
            endif;
        endif;
    end;
    

Upvotes: 2

Related Questions