sookeke
Posts: 9
Joined: Wed Apr 12, 2023 4:35 pm

Custom Action Do not work correctly on Silent install

Hi All,

We have an MSI installer that was built with an Advances installer. First, we have a custom PowerShell script that should be triggered to uninstall a previous exe version if found. This works as expected with the UI but we noticed that this custom action will trigger but with an error when installing silently. Here is the setting

Note: what we have done
  • add the custom action both in the wizard dialog stage and install execution stage
Still, the uninstall didn't run (the software didn't uninstall)

For example in the custom script, I added a show message box below the uninstall action to check if the custom script is getting triggered, the start-process got triggered but with a 1618 error

$process = Start-Process $unistallString -ArgumentList "/quiet", "/uninstall" -PassThru -Wait

if($process.ExitCode -ne 0){
[System.Windows.Forms.MessageBox]::Show("Uninstall exit with error code {0}. exe could not uninstall", $process.ExitCode)
throw 'EXE uninstall error'
}

This is throwing error 1618 i.e. another process installation is already in progress. I think the silent install already kicked off while trying to uninstall at the same time?

How do I fix this?

Note this works well for UI installation and with /qr installation
Liviu
Posts: 1042
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Custom Action Do not work correctly on Silent install

Hello,

Windows Installer allows only one MSI-based installation to run at any given time.

That is mainly happening if you are running your custom action on deferred stage. The deferred (during the "InstallExecution" stage) stage represents the stage where the system is being modified (files are copied/installed, registries are changed, etc.). Also, the Windows Installer does not allow two installation processes to be happening at the same time (e.g. you can not install two setups at the same time, the installation process of the first setup must first ends in order for the installation process of the second setup to start).

Therefore, if you launch another MSI package while an MSI installation is in progress, you will see the "MainEngineThread returns 1618" error.

You can try to add your custom action after the Finish Execution action. For more details, please see the Uninstalling program via powershell custom action forum thread.

Also, is the previous EXE you are trying to uninstall an old version of the main package or just another application? If it is an old version of your application and it has an upgrade code, you can easily uninstall the old version with our support. You can check the How to upgrade an older version of the package
article.

Hope this helps!

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

Return to “Common Problems”