I've tested and ran my PS1 scripts and they ran find without any problem. So I tried to integrate them into my WiX installer but they just fail but the stupid installer never give back anything meaningful on why it failed...
I have these in my WiX wxs file:
<Property Id="InstallPlugin" Value=""Powershell.exe -File [#InstallPS1]"" />
<CustomAction Id="InstallPlugin" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
<Property Id="UninstallPlugin" Value=""Powershell.exe -File [#UninstallPS1]"" />
<CustomAction Id="UninstallPlugin" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="InstallPlugin" Before="InstallFinalize">NOT Installed</Custom>
<Custom Action="UninstallPlugin" After="InstallInitialize">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
I captured the install log, I can see the script being called and then failed with code 1603, which doesn't really mean anything...
MSI (s) (F0:B0) [11:15:45:969]: Running as a service.
MSI (s) (F0:B0) [11:15:45:972]: Hello, I'm your 32bit Elevated Non-remapped custom action server.
WixQuietExec: Entering WixQuietExec in C:\Windows\Installer\MSI19C1.tmp, version 3.11.1701.0
WixQuietExec: "Powershell.exe -File C:\Program Files (x86)\Blah\install.ps1"
WixQuietExec: Error 0x80070002: Command failed to execute.
WixQuietExec: Error 0x80070002: QuietExec Failed
WixQuietExec: Error 0x80070002: Failed in ExecCommon method
CustomAction InstallPlugin returned actual error code 1603 but will be translated to success due to continue marking
I've tried various combinations of the CustomAction
attributes but that didn't help at all. I would love to use Return="check"
but that would prevent my installer to finish (my installer has no problem installing everything else, there is no errors, is only the ps1 script somehow blocking).
If I navigate to my installed folder, say, C:\Program Files (x86)\Blah
and manually run my script, .\install.ps1
, it ran and behave as expected.
Can any WiX experts give me some tips of troubleshooting this? Googling around didn't help...
PS: In the install.ps1
it would launch a elevated powershell session (but it shouldn't matter since the person running the installer must have admin rights to begin with), I'm not sure if that's causing the error, and if yes, then how can I workaround my script launching another script?
Edit:
The script I'm trying to run in question is posted here in the superuser forum. Essentially, I'm just going through the Windows Registry trying to find the Exchange Server installed and grab the built-in EMS script and load it.