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:
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:- Do I need to turn $ContinueOnError from $false to $true or I can achieve this differently?
- Which variable I can catch to use for $exitcode?
-
Or is this already implented in some way, I am not aware of?