This project is read-only.

Continue Toolkit actions on MSI installation error

Topics: Archive - General
Apr 1, 2015 at 2:42 PM
Hi!

I'd like to use this toolkit to install some 3rd party software, but this quite often fails because the MSI installer could not update or remove some registry keys. These can be done using different script, but I'd like to include error control inside the deployment script.

Right now I can turn Execute-MSI function's parameter $ContinueOnError from $false to $true and then do the necessary registry tweaks, but these depend on the errorcode I get from failed MSI installation.

I can't find out how can I catch the MSI installation errorcode, or which variable to use for that.
Code is something like this:
If ($exitcode = "1603") {
  If (Test-Path "Some registry key") {
      Delete registry key
      Execute-MSI again
      }
  Else {
      Write-Log "This Registry Key Does Not Exist"
      }
  }
Else {
  Do nothing and write exitcode to the scripts output
  }
My questions:
  1. Do I need to turn $ContinueOnError from $false to $true or I can achieve this differently?
  2. Which variable I can catch to use for $exitcode?
  3. Or is this already implented in some way, I am not aware of?
Any help would be appreciated!
Apr 1, 2015 at 3:17 PM
The latest 3.6.1 beta version of the toolkit, found under the "Source Code" tab of this site, has an update that should allow you to do this if you want to test it out.

Execute-MSI has a new parameter called -PassThru which will return the following details about your execution: ExitCode, STDOut, and STDErr output
Apr 1, 2015 at 3:31 PM
Edited Apr 1, 2015 at 3:32 PM
[deleted by submitter]
Apr 1, 2015 at 4:53 PM
Hi Mo,

I hope you add this info to the Docs. I know I will need this functionality at some point!

Thank you for this!