cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Amerisun
Level 3

RegDBGetUninstCmdLine - Sample or Direction?

I have tried to search for this, I need to find out if any old versions of other installations exist (I am wrapping 3 vendor products with my install, including Java) and I want to be able to find them if they are installed and remove them first before installing my application.

Does anyone have an example of this command working? I read the documentation, but I don't know enough to formulate how the script should look to work yet.

Thanks for any information.
Labels (1)
0 Kudos
(4) Replies
DMorisseau
Level 5

It's going to depend on how the uninstallation information is stored. RegDBGetUninstCmdLine's 1st argument is the key under HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall - in setups built with older versions of IS (before 6.0), the would be the appname, in all later versions, its the GUID.

So you would be running three tests:

nResult = RegDBGetUninstCmdLine(szKey1,svResult);
if nResult = 0 then
// Uninstall Product 1
endif;

nResult = RegDBGetUninstCmdLine(szKey2,svResult);
if nResult = 0 then
// Uninstall Product 2
endif;

nResult = RegDBGetUninstCmdLine(szKey,svResult);
if nResult = 0 then
// Uninstall Product 3
endif;

NOTE: svResult is a combination of both the app name and any command-line arguments, so you may need to split the string up into 2 parts to pass to LaunchAppAndWait/LaunchApplication. If any of these setups were built with IS, you'll want to include the /clone_wait parameter to ensure that the main installation does not continue until the called setup program finishes processing.
0 Kudos
Amerisun
Level 3

DMorisseau,

So I see the confusing part for me was the svResult which is actually a return value that I should use to launch the uninstaller.

I am using an Basic MSI project so I think I should use the DoInstall instead?

Thanks for your time in responding!
0 Kudos
DMorisseau
Level 5

I'm not sure that DoInstall is appropriate in this case. You may want to use an InstallScript CustomAction to do this, and schedule it to occur during the Execute Sequence, and set the execution condition to Not Installed to ensure this happens only the 1st time the setup is run.
0 Kudos
Amerisun
Level 3

It would seem any method I tried to uninstall this product would not work. I tried the RegDBGetUninstCmdLine and that returned a blank, so I couldn't use it to run the uninstall.

I then tried to manually execute MSI with the GUID of the application from the registry key I went and hunted down manually, and it can't run an MSI if another MSI is running, so the uninstall wouldn't work either.

I think I will have to have my application just check if the previous is installed and just bomb out and let the end user / automated process report the issue and have someone manually uninstall unfortunately. 😕
0 Kudos