Passing command line parameters during MSI installation

Adam,

I need my CustomAction Installation script to be able to read session parameters when passed during MSI execution using a command line, rather than interactively, so it can be executed by SCCM in quiet mode. Something like:

msiexec /i CustomActionSetUp.msi LIC=“xxxxxxxxxx” NAME=“nnnnnnnn”

The documentation I could find for this (i.e. http://davton.com/blog/how-to-pass-custom-actions-to-a-wix-installer-using-command-line-arguments/) states the Installation script must be a DLL that will be able to read the Session hashtable pointed by object [Microsoft.Deployment.WindowsInstaller.Session]. However, I don’t know how to obtain those values from a PS1 script.

I wonder if you can advise on this. Perhaps a Helper DLL that later invokes the Installation script, passing the Session parameters would be the solution.

Regards,

I haven’t tried to do something similar so I will have to give it a shot and let you know.

I found the way to accomplish this, by creating a Property with Id and Value, and then referencing the Id contents in square brackets [variable name] as in here:

It would be nice to have a new cmdlet (perhaps New-InstallerParameter that specifies an ID and Value, and that can also be referenced as part of an argument, perhaps by using a variable name $param.value.

1 Like

Adam, please add this as an enhancement request:

It would be nice to have a new cmdlet (perhaps New-InstallerParameter that specifies an ID and Value, and that can also be referenced as part of an argument, perhaps by using a variable name $param.value.

Good idea! Tracking here: https://github.com/ironmansoftware/poshtools-issues/issues/10