Page 1 of 1

How to "respond" to the EXITCODES of MSI installations

Posted: 12. May 2018, 08:29
by Theo_Gottwald
After discussion with a forum colleague, installations can not be made with a single call to an MSI package.

There must be time to respond to the return of an MSI call (error level, exit code) accordingly.
Such scripts can become complex and be several pages long.

Thanks to its script programmability, the MPR offers ideal conditions for this.
And so has the potential to shorten such scripts and simplify.

Here's an example of how to "respond" to the EXITCODES of MSI installations with the MPR.

I commented on the details in the code.
I've just included a treatment for 2 possible EXIT codes:

-> 0 - all ok
-> 1639 - invalid MSI parameters
-> then comes with CEL\ (ELSE) a general message for all other returns that are not explicitly treated.

The use of SLC\ is simpler than querying every single option with IVV\ (IF ... ELSE ... ENDIF).
The SLC (SELECT CASE) option provides unlimited possibilities to respond to returns from MSI packages.

The TightVNC installation serves as an example here.

Code: Select all

KRM\2
'
'
VAR\$$EXE=?path\tightvnc-2_8_5-setup-64bit.msi

VAR\$$P01=/quiet
VAR\$$P02=/norestart 
VAR\$$P03=ADDLOCAL="Server,Viewer" 
VAR\$$P04=VIEWER_ASSOCIATE_VNC_EXTENSION=1
VAR\$$P05=SERVER_REGISTER_AS_SERVICE=1
VAR\$$P06=SERVER_ADD_FIREWALL_EXCEPTION=1
VAR\$$P07=VIEWER_ADD_FIREWALL_EXCEPTION=1
VAR\$$P08=SERVER_ALLOW_SAS=1
VAR\$$P09=SET_USEVNCAUTHENTICATION=1
VAR\$$P10=VALUE_OF_USEVNCAUTHENTICATION=1
VAR\$$P11=SET_PASSWORD=1
VAR\$$P12=VALUE_OF_PASSWORD=PASSWORD
VAR\$$P13=SET_USECONTROLAUTHENTICATION=1
VAR\$$P14=VALUE_OF_USECONTROLAUTHENTICATION=1
VAR\$$P15=SET_CONTROLPASSWORD=1
VAR\$$P16=VALUE_OF_CONTROLPASSWORD=PASSWORD

VAR\$$PAL=$$P01 $$P02 $$P03 $$P04 $$P05 $$P06 $$P07 
VAR\$$PAL=$$PAL $$P08 $$P09 $$P10 $$P11 $$P12 $$P13 
VAR\$$PAL=$$PAL $$P14 $$P15 $$P16

' Call the MSI-Installers
VAR\$$MSI=?ws\msiexec.exe 
EXS\$$MSI /i "$$EXE" $$PAL 
' Ermitteln der Process-ID
VAR\$$PID=$v4$
' Wait for End of Installation
WPT\$$PID

' Get Exitcode from PID
PEC\$$PID>$$EXI

' Here comes the SELECT CASE Variant of the MPR

SLC\$$EXI
CSE\0
   MBX\Paket successful installed!
CSE\1639
   MBX\Bad MSI-Parameter
CEL\
   MBX\Undefined Returncode: $$EXI
ESL\
@