PowerShell Custom Actions Failing at Runtime

PowerShell Custom Actions Failing at Runtime

Summary

1603 Error occurs with a powershell custom action after upgrading to InstallShield 2015 or above.

Synopsis

InstallShield allows you to create a powershell custom action and launch it from your installation. If you migrate an older project into InstallShield 2015 or above, your previously working powershell custom actions may now fail with a 1603 error. This knowledge base article will explain a possible cause as to why this behavior is occurring and how you can resolve it.

Discussion

If your powershell script contains a Write-host command, this was ignored in previous versions of InstallShield. However in InstallShield 2015 and later, the Write-host call will cause an error since it is for hosts that support user interaction (...Basic MSI or Suite-hosted powershell scripts are not meant for user interaction, since both Basic MSI and Suite projects have their own preferred methods for user interaction).

Workaround

If you can simply remove your calls to Write-host in your powershell script, this alone should resolve the error. However if you have a number of Write-host calls in your powershell script, then you can workaround this by overriding Write-Host with functions that do nothing. For example, this can be done once at the top of your powershell script...

function Write-Host {}
# optionally others such as: function Write-Verbose { }
...
Write-Host "Blah" # does nothing
...
Was this article helpful? Yes No
No ratings
Version history
Revision #:
1 of 1
Last update:
‎Jul 12, 2018 09:49 PM
Updated by: