Can I ignore exitcode on execute msi

Execute-MSI -Action Uninstall -Path “{D346782C-C0DC-4758-9019-1C71C12F041F}”

if this exits with a 1603 can I ignore that and continue for code after.

it just exits after the error. I know for execute process I can -ignoreexit code

help please?


Hi Ocsscott,

yes use -ContinueOnError parameter or -IgnoreExitCode in Execute-MSI

continueonerror did nothing the code still exited. and -ignoreexitcode said it was invalid

Please show us the line you are using.

Execute-MSI -Action Uninstall -Path “{D346782C-C0DC-4758-9019-1C71C12F041F}” -ContinueOnError $true -ErrorAction SilentlyContinue

I tried with the -PassThru -IgnoreExitCodes “*” and that said the ignoreexitcodes was invalid

Hi Scott,

although you can use -error action silently

Dayst1 not sure what you mean exactly

I’m amazed you don’t care why your MSI uninstall blows up.
If you want to find out, make it create a log file:

Execute-MSI -Action Uninstall -Path “{D346782C-C0DC-4758-9019-1C71C12F041F}” -ContinueOnError $true -LogName "removeMSI.log"

FYI: -ErrorAction is NOT a parameter for the Execute-MSI function

Also having the exact error messages would help.

in this case I know why its blowing up and Dont care just want the rest of the code to run after

I was hoping to get the PSADT error message as to why Execute-MSI can’t just $ContinueOnError.

Since Execute-MSI calls Execute-Process, maybe try to cut out the middle-man and call Execute-Process directly.

Also try not to use $ContinueOnError and $PassThru on the same command. I think $PassThru automatically continues regardless of $ContinueOnError. So this should work:

$Results = Execute-MSI -Action Uninstall -Path “{D346782C-C0DC-4758-9019-1C71C12F041F}” -PassThru $true

I have to admit, I have never needed to continue after an MSI fails.

If you want to ignore 1603, which means a fatal error. Then just remove the uninstall commando.

Or doesn’t this happen on all machines?

Anyway continue on error is the key.

it doesnt happen all the time it has to do with password protected installs and several past passwords so some exit 1603 just means bad password so I want to ignore and go to the next line…etc