nlindberg
Posts: 8
Joined: Mon Jun 09, 2014 4:23 pm

Using AI to run batch file only or is there a better way?

We have an application that when uninstalled, leaves behind the following:

4 Registered DLL files (need unregistered)
A path in %Program Files% (needs deleted)

I have two batch files created that will do this, however, I would rather package them up and run them together. How can I accomplish this with Advanced Installer? (Or is it possible to accomplish this from AI without the batch files? This application was not built with AI, but is part of a cleanup process).

I have tried setting up an MSI to accomplish this. First I added the .bat files as Temporary Files. Then I've added a custom action to "Launch File" for the first batch file and another "Launch File" for the second batch file. Every time I try to run the MSI that I build, I get the following error:

"There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your ....."

I've tried removing one of the batch files thinking that might be it. But removing either of the two produces the same result. Anyone have any thoughts?
nlindberg
Posts: 8
Joined: Mon Jun 09, 2014 4:23 pm

Re: Using AI to run batch file only or is there a better way?

This is my custom action.
Attachments
Uninstall.JPG
Uninstall.JPG (99.43 KiB) Viewed 3515 times
Sorin
Posts: 663
Joined: Mon May 08, 2017 1:03 pm

Re: Using AI to run batch file only or is there a better way?

Hello,

The implementation using bat files added as temporary files is correct.

The behavior could be encountered because your custom action doesn't have enough privileges. Please try to set "When the system is being modified(deferred)" execution time and enable "Run under the LocalSystem account with full privileges (no impersonation)" option as well.

Please take a look on our article : How to launch a CMD or BAT file

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nlindberg
Posts: 8
Joined: Mon Jun 09, 2014 4:23 pm

Re: Using AI to run batch file only or is there a better way?

I used that article for my initial setup, appreciated the info it provided. Actually figured out it was one of our security apps that was causing that error to be thrown. Got my MSI unblocked, and we're good to go. Thanks for the reply!
nlindberg
Posts: 8
Joined: Mon Jun 09, 2014 4:23 pm

Re: Using AI to run batch file only or is there a better way?

Just curious, is it possible to run msiexec /x {productcode} /qn between the two batch files?
Sorin
Posts: 663
Joined: Mon May 08, 2017 1:03 pm

Re: Using AI to run batch file only or is there a better way?

Hello,

I'm glad that you've sorted things out.
Just curious, is it possible to run msiexec /x {productcode} /qn between the two batch files?
Please note that Windows Installer doesn't support running two installation at the same time. The only possible way you could run a msiexec process is through a custom action placed after "Finish Execution" stage. Even in this way, you have to implement a software delay to ensure the original msiexc process is terminated before the new one is launched. For example, you could launch the following bat file:

Code: Select all

timeout 10
msiexec /x %1 /qn /l* c:\users\ieuser\uninstall.log
This implementation will create a 10 seconds delay between the moment the custom action is launched and the execution of msiexec command. Depending on you package size and complexity a longer delay may be neded.

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”