asif0012
Posts: 44
Joined: Tue Nov 22, 2022 6:30 pm

How to use PowerShell script or custom executable before installing prerequisites to verify the launch conditions

Hi,
I want to add launch conditions before installing the prerequisites. I can do that using "Check launch conditions before searching for prerequisites" option. But I need to perform a custom search for the launch conditions, which is not possible with the predefined support in Advanced Installer. However, I can conduct the custom search using a PowerShell script or custom executable.

How can I run a PowerShell script or custom executable before installing prerequisites to verify the launch conditions?
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: How to use PowerShell script or custom executable before installing prerequisites to verify the launch conditions

Hello,

If you want to run a custom action before installing your prerequisite, you could use the following option from the "Prerequisites" page --> "Setup Files" tab:
Screenshot_86.png
Screenshot_86.png (4.96 KiB) Viewed 7506 times
Please note, however, that the above option only works for "pre-install" prerequisites.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
asif0012
Posts: 44
Joined: Tue Nov 22, 2022 6:30 pm

Re: How to use PowerShell script or custom executable before installing prerequisites to verify the launch conditions

Hi Catalin,
I need to use the "Check launch conditions before searching for prerequisites" option because I have some prerequisites files in my installer. I want to stop installation using "Launch Conditions" before the prerequisites installation.

Suppose I use a PowerShell script and save the result in an Installer property. Will I be able to use it in the "Launch Conditions"? Is it possible to execute the PowerShell script before the "Launch Conditions" validation?

"Check launch conditions before searching for prerequisites" option:
"Check launch conditions before searching for prerequisites" checkbox
"Check launch conditions before searching for prerequisites" checkbox
Screenshot 2023-02-12 172254.png (246.41 KiB) Viewed 7499 times

In the attached AIP file, PowerShell script execution doesn't happen before the "Launch Conditions". So, it doesn't prevent the installation.
Check Lanuch Condition.aip
Check Launch Condition
(24.81 KiB) Downloaded 178 times
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: How to use PowerShell script or custom executable before installing prerequisites to verify the launch conditions

Hello,

There's a bit of a "sketch" here.
Suppose I use a PowerShell script and save the result in an Installer property. Will I be able to use it in the "Launch Conditions"? Is it possible to execute the PowerShell script before the "Launch Conditions" validation?
Normally (e.g. feature-based prerequisite), yes, but I'm not quite sure about the prerequisite being pre-install.

For feature-based prerequisites, you could achieve that by scheduling the custom action before the "Paths Resolution" action group (in which the launch conditions are evaluated):
Screenshot_88.png
Screenshot_88.png (57.52 KiB) Viewed 7335 times

The problem in your case is that you have the prerequisite scheduled as "pre-install", meaning the check is actually done before the execution of our custom action. Basically, in this case, we can not schedule the custom action before the launch condition is actually evaluated.

That being said, please move your prerequisite to "feature-based" and this should work just fine.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”