duggit
Posts: 5
Joined: Thu Aug 07, 2008 9:13 pm

[custom actions] - execution condition

Wed Feb 04, 2009 5:10 pm

My MSI I am building needs to use a custom action that runs an unwise.exe uninstaller only if the program needs to be uninstalled. I got 90% of the way there by using the Execution Condition (Not Installed) but the problem I run into is that it only works when the computer already has the program and unwise.exe.

I've tried several execution conditions like :

Code: Select all

(Not Installed) AND (?UNWISE.EXE = 3)
But they don't work as I want them to, is there a way around this? Basically I don't want the action to run if the unwise.exe is not found on the destination computer that I am trying to install to. (meaning; the legacy software is currently installed and should be uninstalled before I upgrade the computer to my new repackaged MSI version)

I think I may be going about this all wrong - is there a way to check for files (that aren't part of the MSI) on the destination computer?? What am I missing?

Thanks,
Nick

Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact:  Website

Re: [custom actions] - execution condition

Wed Feb 04, 2009 10:17 pm

Hi Nick,

The user guide contains a how-to article regarding the removal of an older version of a package. In your case, the old package is most likely not MSI-based.
I think I may be going about this all wrong - is there a way to check for files (that aren't part of the MSI) on the destination computer?? What am I missing?
You can use a Search for this purpose. My advice is to look under the following registry key (using "regedit") for a subkey with the name of the legacy application you want to remove:

Code: Select all

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
If you find a subkey containing the uninstall information for the application you are interested in as described above, most likely there should be a registry value named "UninstallString" which contains the full path to the uninstaller of the legacy application (probably with parameters). If this registry value is present, you can create a Search for it. Use the "Test Search" toolbar button in order to test your Searches.

The result of the Search will be used in a Custom Action that will invoke the uninstaller.

Hope this helps.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

duggit
Posts: 5
Joined: Thu Aug 07, 2008 9:13 pm

Re: [custom actions] - execution condition

Thu Feb 05, 2009 4:12 pm

Your instructions helped me run the uninstaller at the right times; but now I'm running into another issue - the uninstall string in the registry doesnt include the '/A' switch that I need in there to make this uninstallation run unattended/silent/automatic. How could I remedy this?

Code: Select all

[UNWISE] /A c:\Progra~1\myprogram\install.log 
the code above works, but will give popup errors complaining when the custom action runs when the legacy exe version of my app is not installed. ( the unwise property returns null and hence the command line string doesnt make sense anymore - it returns an error not knowing what to do with /A )

Other Ideas I've tried - I have a .vbs script that I wrote that will do everything I need, but I get errors when I run the custom action:

installed custom action
error reading from file ... verify that file exists and that you can access it. (it doesnt exist yet because my custom action runs before the MSI installs files)

attached custom action
There is a problem with this Windows Installer Package. A script required for this to install to complete could not be run. Contact your support personnel or package vendor.

I really appreciate your ideas!

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:  Website

Re: [custom actions] - execution condition

Thu Feb 05, 2009 4:41 pm

Hi,
CODE: SELECT ALL
[UNWISE] /A c:\Progra~1\myprogram\install.log

the code above works, but will give popup errors complaining when the custom action runs when the legacy exe version of my app is not installed.
You can make sure that the custom action runs only when the EXE is found by using the UNWISE property in its condition. The expression "UNWISE" is true if the UNWISE property is not empty.
attached custom action
There is a problem with this Windows Installer Package. A script required for this to install to complete could not be run. Contact your support personnel or package vendor.
I'm not sure why you are encountering this behavior. If the problem persists, please send us the AIP and VBS files you are using to support at advancedinstaller dot com so we can investigate them. Also, please attach a verbose log of the install process.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”