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
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