ppep
Posts: 5
Joined: Thu Feb 04, 2021 10:25 pm

How to: uninstall more than one msi

Hello,

My application installs one or more of our other applications as prerequisites. At uninstall time we want to remove these other prerequisite installs as well.

I followed the instructions from the user guide here: https://www.advancedinstaller.com/user- ... l-msi.html
This works fine if I only need to uninstall one other msi, but in my case I may have more than one. Adding multiple custom actions for each msi to be uninstalled results in only one app being uninstalled. I understand this doesn't work because there are collisions when trying to run more than one uninstaller at the same time.

How do I wait for one uninstall Custom Action to finish before the next one starts? I tried using a PowerShell script to make multiple calls but that still doesn't wait for one to finish before calling the next one. I even tried putting a Sleep call in between like below:

Code: Select all

$cloudProductCode = (AI_GetMsiProperty GSI_CLOUD_UPLOAD_PRODUCT_CODE)
$isProductCode = (AI_GetMsiProperty SEARCH_I_S_PRODUCT_CODE)

$process = Start-Process -FilePath msiexec.exe -ArgumentList "/X $isProductCode /passive"
Start-Sleep -seconds 5
$process = Start-Process -FilePath msiexec.exe -ArgumentList "/X $cloudProductCode /passive"
Any suggestions on how to accomplish this?

Thanks,

Peter
Liviu
Posts: 1419
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: How to: uninstall more than one msi

Hello Peter,

I'm not sure why that happens. Can you please test your PowerShell script outside of Advanced Installer and and let me know if that works as expected?

You need to set this custom action after the "Finish Execution" stage and disable the "Wait for custom action to finish before proceeding" and "Wait for return code at the end of the sequence" options from the custom actions properties. The custom action that will trigger the prerequisite uninstall will only run on Uninstall.

Please note that users may already have had your prerequisite installed before they installed your application. They may not want you to uninstall the prerequisite. You should notify them somehow that you are going to uninstall it along with your product, and give them the choice to prevent that.

As another solution to achieve that, you can make use of the "Uninstall using this command line:" option from "Prerequisites" page --> your prerequisite --> "Setup Files" tab --> "Maintenance Command Lines" section:

"Prerequisites Setup Files Tab"

However, this option is available only for "Feature-based" and "Post-install" prerequisites.

The Pre-Install prerequisites are handled by bootstrapper in a separate process. After the prerequisite finish installation then the .msi package is launched by the bootstrapper.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”