Jason.Esposito
Posts: 1
Joined: Thu Dec 10, 2020 2:15 pm

How to create an installer that is deployable on mass

Hello all,

We currently have a working installer (exe) that can be used to install on a single user machine. We would like to be able to allow the user to install the application via command line and pass in arguments such as a registration key to make the process of onboarding easier.

Use case: Run our .exe installer whilst passing command line arguments properties that are used in an attached file.

Example command line: installer.exe REGKEY=12345 FIREWALL=enabled APPLICATION=disabled

When the user decides to install the application only via command line this I would like to execute a custom action that will launch an attached Javascript file. The Javascript file will take the properties from the command line and 'do something' (calls our api to register application and toggles some settings).

Questions:

1. How can we launch the custom action only if user decides to install via command line, is this possible?
2. How do I pass in the properties from the command line into the JS file?

Thanks in 'advance' ;)

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

Re: How to create an installer that is deployable on mass

Hello Jason and welcome to our forums,
1. How can we launch the custom action only if user decides to install via command line, is this possible?
Unfortunately, it is not possible to know whether a setup was launched through command line or simply by double clicking on the setup.

Judging by your scenario, a way of doing this be if some (at least one) of the properties are not set during a normal installation (e.g. when the user double clicks the setup).

Let's consider:

- during a command line installation, the user declares the following properties: REGKEY, FIREWALL and APPLICATION

- during a normal installation, one of the properties is not defined, e.g.: REGKEY

This way, based on the state of the REGKEY property (it either exists or not), we can decide whether the setup was launched through command line or not.

Another way I can think of right now would be to make use of the silent switch. Even though you did not mention this, I am assuming the installation from the command line will be done with a reduced ui / no UI at all (otherwise there is pretty much no point in launching it through command line - unless the setup is deployed through GPO/Intune/etc.)

If this is the case, we can make use of the UILevel property. If the UILevel equals to "2", we know it's a silent installation and that the installation was performed through command line.
2. How do I pass in the properties from the command line into the JS file?
Regarding this, I am not quite sure how you are launching the JS file. If possible, could you please give me some more details so I can further assist?

For instance, if you are launching it through a "Launch File" custom action, you can use the "Command Line" field to pass the properties.

Hope this helps!

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

Return to “Building Installers”