How to run temporary BAT on end of install - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

How to run temporary BAT on end of install

Hi,

I defined a temporary BAT file in the main package which contains a command installed by one chained msi.

The BAT should be executed on end of install process if all chained packages are installed.
I defined Lauch File Custom Action in InstallFinalize but nothing happens.

Where is my mistake?

Thank you
Igor
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to run temporary BAT on end of install

Hi Igor,

Temporary Files are copied during the CostFinalize standard action, at the beginning of the setup and removed during the InstallFinalize standard action.
If your custom action is schedule after InstallFinalize, this may be the reason and you schedule it before that standard action.

Here're a couple of related articles to help:
http://www.advancedinstaller.com/user-g ... ation.html
http://www.advancedinstaller.com/user-g ... -file.html

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: How to run temporary BAT on end of install

Hi Mihai,

I think I defined the custom action as described in your articles but it still doesn't work.

I think the problem is the BAT is launched before chained MSI package is installed. It should be launched after this. In the BAT are commands that exist after chained MSI was installed. Is there a way to do it?

Regards
Igor
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to run temporary BAT on end of install

Hi Igor,

At that point, all the package's resources are already copied on the target machine.

If you need to install another package you can use a feature-based prerequisite set with "Chain prerequisite installation after main package":
http://www.advancedinstaller.com/user-g ... tions.html

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: How to run temporary BAT on end of install

Hi Mihai,

you are right at this point. The BAT is already copied on the target machine. But the command issued by this BAT after main package was installed will be copied later to target machine during MSI installation of this another chained package.

I cannot use feature-based prerequisite because I'm using limited user interface.

Is there another way to run BAT file from main package after all, main + chained packages, have been installed? (Post-Install steps)

Regards,
Igor
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to run temporary BAT on end of install

Hi Igor,
I cannot use feature-based prerequisite because I'm using limited user interface.
You can easily pass command line options to your prerequisite depending on the main package's user interface level:
http://www.advancedinstaller.com/user-g ... rereq.html
Is there another way to run BAT file from main package after all, main + chained packages, have been installed? (Post-Install steps)
This could be attempted somehow via a "Finish" button action published event that executes your own UI Custom Action. This custom action can perform all post install operations you need.
However, this means you won't be able to add the BAT as a temporary file anymore. All temporary files are removed during InstallFinalize standard action which is before the ExitDialog is shown.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: How to run temporary BAT on end of install

Hi Mihai,

maybe we do not understand us.

I'm using basic UI. No user choices are allowed or necessary. The package is designed for automated software distribution. The setup.exe will start installing the software, and exits.
In the first step the main package is installed. The main package contains this BAT. After main package is installed the BAT is launched (I can see the black dos windows) but the execution fails. In the next step the chained MSI is installed. The command issued by BAT is just now available on target machine.
The BAT should be executed after main package and chained MSI is installed.

Thank you
Igor
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: How to run temporary BAT on end of install

...or the chained MSI should be installed first and then the main package. I have to use chained package because I want to uninstall all chained MSI packages and main package in one uninstall step.

Kind regards,
Igor
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: How to run temporary BAT on end of install

Hi Igor,

The problem is that if the custom action is placed under InstallFinalize it is set as "Immediate" so it will get executed before the chained packages. Can you please try to scheduled the custom action under "InstallIIS" standard action, as "Deferred with no impersonation" and try the package again?

To understand what is the difference between immediate and deferred custom actions I recommend the following article:
http://www.advancedinstaller.com/user-g ... tions.html

The above article will help you understand a lot of what is going one when the installer enters the execute stage and starts modifying the system, i.e. installing the new resources.

Back to your custom action, I am still no 100% sure it will work because of the way Windows Installer handles chained packages. What happens when you install a chained package is that Windows Installer merges the system changes into a single transaction, so the files/registry entries from the chained package will be placed on the machine at the same time with the ones from the main one. Theoretically this should allow the custom action to find the required resources when running as deferred.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”