Installation of bootstrapper using command line

Having trouble running Advanced Installer? Got a bug to report? Post it all here.
Balaji
Posts: 38
Joined: Wed May 06, 2020 9:15 am

Installation of bootstrapper using command line

Post by Balaji » Thu Sep 03, 2020 6:01 am

Hi,
Greetings of the day!!!
We have prepared one bootstrapper.
In this bootstrapper, we have added one functionality, which will detect required software is installed or not. If yes, then only proceed to install.Otherwise, display error message and exit the installation process.

We can install bootstrapper using two ways :

1. Using UI :

If required software is not installed and we are trying to execute bootstrapper EXE by double clicking on it, it will display error message and will not allow to install bootstrapper.
Please refer attached image.
SoftwareDetection.png
SoftwareDetection.png (51.06 KiB) Viewed 563 times

2. Using Command line:

To install bootstrapper we have used following command :

start "" "E:\Bootstrapper EXE\BootstrapperPrj.exe" /qn

Note: please note that we want to install it silently. So, used /qn argument.

But, when I execute this command it is installing bootstrapper. I don't want to install bootstrapper if required software is not available on my machine.
I know, it is because we are trying to install it silently.
But, is there any way to install bootstrapper silently using command line and if required software is not available then don't install the bootstrapper?

Is there any respective command on AI?

Also, I have attached an aip project.
BootstrapperPrj.aip
(77.65 KiB) Downloaded 20 times
Let me know your comment on this.

Thanks!
Balaji

Catalin
Posts: 3394
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation of bootstrapper using command line

Post by Catalin » Thu Sep 03, 2020 9:55 am

Hello Balaji,
But, when I execute this command it is installing bootstrapper. I don't want to install bootstrapper if required software is not available on my machine.
I know, it is because we are trying to install it silently.
But, is there any way to install bootstrapper silently using command line and if required software is not available then don't install the bootstrapper?
When installing silently, if your software is not found on the machine, the setup will not be installed.

Please note that the launch condition will still be evaluated and it will stop the installer if it's condition is false.

It is true, however, that the message will no longer be spawned, since you are installing silently. With that being said, if the user wants to know why the setup was not installed, he should run the .EXE with the log command (/L*V).

Hope this helps.

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

Balaji
Posts: 38
Joined: Wed May 06, 2020 9:15 am

Re: Installation of bootstrapper using command line

Post by Balaji » Tue Sep 08, 2020 2:03 pm

Hi Catalin,
Is it working as expected at your end?
If yes then can you share working bootstrapper aip file?
It will help me to understand it efficiently.


Thanks,
Balaji

Catalin
Posts: 3394
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation of bootstrapper using command line

Post by Catalin » Fri Sep 11, 2020 11:13 am

Hello Balaji,

Yes, it is working as expected on my end.

Here's how you can proceed:

- create a new Advanced Installer project

- change the package type to "EXE"

- in "Launch Conditions" page --> "Custom" tab, add a false condition, e.g.:

Code: Select all

1=2
- build the project

- open an elevated command prompt and run the EXE as it follows:

Code: Select all

setup.exe /exenoui /qn
Now check the Control Panel. The application should not be installed, even though the launch condition message was not spawned.

Hope this helps.

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

Balaji
Posts: 38
Joined: Wed May 06, 2020 9:15 am

Re: Installation of bootstrapper using command line

Post by Balaji » Fri Sep 25, 2020 6:53 am

Hi Catalin,
Yes, it is working fine at my end as well.
But, can we show error even if we are trying to execute it silently?

Because, what I found,

1. UI installation :

if launch condition is false, then it display it's description message. And stops bootstrapper execution. i.e. It will not install bootstrapper(Works as expected)

2. Command-line silent installation :

if launch condition is false, then it is not giving any error also, will not install bootstrapper.

Can, we give error using silent installation?


Thanks,
Balaji

Catalin
Posts: 3394
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation of bootstrapper using command line

Post by Catalin » Mon Sep 28, 2020 5:38 pm

Hello Balaji,

It looks like I have misunderstood your scenario here. I thought the LC description was appearing during a silent installation, which would be wrong, but it seems like this is what you are looking for.

Indeed, as you have mentioned, the LC description will not appear during a silent installation. In the past, we had it just like that, but it was requested by our users that we do not show it during a silent installation, so we changed it.

If you want to show some UI during silent installation, you could do so through a script. For instance, you can use VBS together with our "Execute inline script code" custom action to spawn a messagebox. If I'm not mistaken, you can even configure the look of the messagebox so it looks like an error (e.g. adding the red exclamation mark).

You can then schedule this custom action between the "Searches" and "Paths Resolution" action groups, under the "Install Execution Stage". This would be right before the LC is evaluated, which is exactly what we need. The messagebox will be spawned, letting the user know why the setup failed, then the LC will be evaluated and the actual failure of the main setup will happen.

In addition to that, you can condition the custom action to only spawn the messagebox in case of a failure, so it is spawned only when the LC is failing as well.

To do this, you might need to negate the condition used for your LC, because a LC is triggered only when its' condition is evaluated as false.

For instance, if you have the "1=2" condition for your LC, the condition for your custom action may be:

Code: Select all

NOT (1=2)
Hope this helps!

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

Balaji
Posts: 38
Joined: Wed May 06, 2020 9:15 am

Re: Installation of bootstrapper using command line

Post by Balaji » Fri Oct 09, 2020 1:30 pm

Hi Catalin,
Yes, I think now you have understood our scenario more clearly.
We want to show only error message in case of failed condition( provided under LC). As we want to install bootstrapper silently other than error message everything should be hidden.
Also, I am trying to write some script using custom actions. As, I am new to this, Is it possible for you to send some sample scripts relevant with our requirement?


Regards!
Balaji

Catalin
Posts: 3394
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation of bootstrapper using command line

Post by Catalin » Thu Oct 15, 2020 12:02 pm

Hello Balaji,
Also, I am trying to write some script using custom actions. As, I am new to this, Is it possible for you to send some sample scripts relevant with our requirement?
A script (VB) that spawns a messagebox may look something as it follows:

Code: Select all

MsgBox "Hello",48,"Title"
The above will create the following messagebox:
msgBox.png
msgBox.png (6.97 KiB) Viewed 353 times
The syntax of this function is:

Code: Select all

MsgBox(prompt[,buttons][,title][,helpfile,context])
The buttons displayed by our messagebox are obtained from the sum of the following values:
0 = vbOKOnly - OK button only
1 = vbOKCancel - OK and Cancel buttons
2 = vbAbortRetryIgnore - Abort, Retry, and Ignore buttons
3 = vbYesNoCancel - Yes, No, and Cancel buttons
4 = vbYesNo - Yes and No buttons
5 = vbRetryCancel - Retry and Cancel buttons
16 = vbCritical - Critical Message icon
32 = vbQuestion - Warning Query icon
48 = vbExclamation - Warning Message icon
64 = vbInformation - Information Message icon
0 = vbDefaultButton1 - First button is default
256 = vbDefaultButton2 - Second button is default
512 = vbDefaultButton3 - Third button is default
768 = vbDefaultButton4 - Fourth button is default
0 = vbApplicationModal - Application modal (the current application will not work until the user responds to the message box)
4096 = vbSystemModal - System modal (all applications wont work until the user responds to the message box)
For instance, you can see that I have used the "48" value in my messagebox. 48 is obtained from "48+0", where:

48 = vbExclamation

and

0 = vbOkOnly

therefore the messagebox will only have 1 button ("Ok") and will be shown as a warning.

Hope this helps!

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

Balaji
Posts: 38
Joined: Wed May 06, 2020 9:15 am

Re: Installation of bootstrapper using command line

Post by Balaji » Thu Oct 22, 2020 6:28 am

Hi Catalin,
Thanks for providing solution approach.
I have tried above VB script. And, yes it is displaying me the error message.
But, it is still continuing to install bootstrapper. I want to display error message and stop further installation of the bootstrapper executable.

How to achieve this ?

Thanks,
Balaji

Catalin
Posts: 3394
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation of bootstrapper using command line

Post by Catalin » Mon Oct 26, 2020 9:37 am

Hello Balaji,

This is quite strange.

Right after the message box is spawned, the Launch Condition should be evaluated and since it will be evaluated as false, the setup should not continue with the installation.

If the Launch Condition is evaluated as false, are you sure that the setup is still getting installed? I have just ran few tests on my machine and everything looked to be working as expected.

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

Balaji
Posts: 38
Joined: Wed May 06, 2020 9:15 am

Re: Installation of bootstrapper using command line

Post by Balaji » Mon Oct 26, 2020 12:31 pm

Hi Catalin,
Thank you for your reply.
I have attached an AIP project, on which I am working.
BootstrapperPrj.aip
(78.09 KiB) Downloaded 9 times
But, I am unable to meet our requirement. Please look it.


Thanks,
Balaji

Catalin
Posts: 3394
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation of bootstrapper using command line

Post by Catalin » Wed Oct 28, 2020 6:59 pm

Hello Balaji,

Thank you for the provided .AIP file.

I have tested the resulted setup (after building the .AIP) and everything is working as expected.

The setup is not installed during a silent installation (if the launch condition is failing).

The only thing is that the message does not appear to the user, since you have scheduled the custom action during the "Wizard Dialogs Stage". Please note that this stage is skipped during a silent installation.
WDS.png
WDS.png (57.97 KiB) Viewed 251 times

With that being said, please:

- make sure the software is not already installed on the machine you are testing this

- make sure the launch condition is indeed failing (if the launch condition does not fail, the setup will of course be installed)

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

Balaji
Posts: 38
Joined: Wed May 06, 2020 9:15 am

Re: Installation of bootstrapper using command line

Post by Balaji » Fri Oct 30, 2020 1:59 pm

Hi Catalin,
Thank you for update.
Yes, I agree that was my mistake. I had put script custom action under "Wizard Dialogs Stage".
And as per your last reply, this stage has skipped during silent installation.
But I want to display error message written in a script while silent installation. So, right now I have put it under "Install execution stage".

It is working fine if required software is not available on my machine. That means it is showing error message and not installing setup as well.

But, when I have that required software on my machine then also, it is showing same error message, but installation has done behind.

I think this is due to condition provided for executing script. Can you check and let me know what wrong I did.
Please see attached updated bootstrapper.
BootstrapperPrj.aip
(78.21 KiB) Downloaded 8 times
Thanks,
Balaji

Catalin
Posts: 3394
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation of bootstrapper using command line

Post by Catalin » Mon Nov 02, 2020 6:24 pm

Hello Balaji,

Thank you for the provided project.

In your case, the custom action is executed and the messagebox is shown because you have scheduled it before the "Searches" action group.

Please note that the custom action relies on the search, thefore it must be executed after the searches are executed.

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

Balaji
Posts: 38
Joined: Wed May 06, 2020 9:15 am

Re: Installation of bootstrapper using command line

Post by Balaji » Tue Nov 03, 2020 1:03 pm

Hi Catalin,
Thank you for providing solution for my issue.
Yes, you are right I have to put custom action after "search".
It help me to fulfill our requirement.

Thank you!
Balaji

Post Reply