Jump to content
ghurty

How to script an MSI install that need input for an argument?

Recommended Posts

I am trying to script an install of an MSI file.

A few questions. Which function is the best to use? Process Execute?

Also, the msi has the option of an argument which will be unique to each location, so I want it the script to prompt me for it when I run. What would the best way to do that?

 

msiexec.exe /I app.msi /quiet ACTIVATION= XXXXXXXXXXXXXX
 

 

Thank you

  • Like 1

Share this post


Link to post
Share on other sites

I'm attempting to do the same, but using a batch file to contain the commands. For example, BarracudaNG.msi and install.cmd will be copied to the client and then I'll run the install.cmd file like I described here. I'll let you know how it goes and report back.

 

Share this post


Link to post
Share on other sites
On 8/6/2018 at 9:23 AM, ghurty said:

I am trying to script an install of an MSI file.

Sounds reasonable.

On 8/6/2018 at 9:23 AM, ghurty said:

A few questions. Which function is the best to use? Process Execute?

"Shell" is a good choice because it runs inside a cmd.exe session as SYSTEM. This allows for things like environmental variables to work (%windir%, etc.) or chaining commands (echo Hello&echo Bye). Process Execute is akin to the Start->Run dialog box. You cannot "execute" built in commands like echo, etc. with Process Execute. Process Execute is fine if the EXE will not care about it's environment, you aren't using environmental variables, etc.

On 8/6/2018 at 9:23 AM, ghurty said:

Also, the msi has the option of an argument which will be unique to each location, so I want it the script to prompt me for it when I run. What would the best way to do that?
msiexec.exe /I app.msi /quiet ACTIVATION= XXXXXXXXXXXXXX

If you click on the "Globals and Parameters" tab when editing a script, you can define up to 5 parameters. These are variables that can be entered when scheduling the script, and referenced when the script runs. For instance, a parameter "ActivationCode" could be added to the script, and when the script runs you could use it in the command line like:

msiexec.exe /i app.msi /quiet ACTIVATION=@ActivationCode@

It would be best to check that ActivationCode has actually been set (parameters are never mandatory, they are only available). An example script that has parameters is "Maintenance\Tickets\Ticket Finish By Ticket Number".

The other way that you could do it is by adding a location level Extra Data Field. You could set the Activation string in the EDF, and then in the script you can retrieve the EDF into a variable. This way the technician doesn't have to look up and provide the value. The command line would look the same. Creating and working with EDF's is more complex, but a very powerful Automation technique.

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×