2

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!

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Could you perhaps say what problem you are trying to solve? Apparently you have decided that you have a solution (manipulate the default uninstaller?) but what problem are you dealing with? Note that there is no actual default uninstaller (unless you want to make one?) because Windows just calls APIs to configure the product to be absent - it does not call a separate program. – PhilDW Jun 04 '18 at 21:15
  • @PhilDW I have implemented a custom OnUninstall function, but it does not get called when I uninstall my programm with the build in Windows Programs and Applications panel. – user3829915 Jun 05 '18 at 15:14

2 Answers2

2

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;
    
Slava Ivanov
  • 6,666
  • 2
  • 23
  • 34
0

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?

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164