v5.4.1 -Arguments parameter is placed wrongly in the WXS. See below
I released version 5.4.2 of the module. This now has a parameter for both the PowerShell.exe (-Arguments) as well as your script arguments (-ScriptArguments) on New-InstallerCustomAction.
Adam, I found out the following incongruence in 5.4.2 New-InstallerCustomAction:
- Install custom action defines -FILE, whereas Uninstall defines -COMMAND.
- -ScriptArguments value is ignored for Uninstall
However, -FILE is good only for PS scripts, whereas -COMMAND works for all other scripts (VBS, BAT, CMD) and executables (EXE) as well.
I suggest that for a PS script i.e.C:\Program Files\BJL\Scripts\mypsscript.ps1 the command would be:
POWERSHELL -NoProfile -WindowStyle Hidden -ExecutionPolicyBypass -File “C:\Program Files\BJL\Scripts\mypsscript.ps1” -Param1 “value 1” -Param2 “value 1” -Switch3
And for non-PS executables, like:
the command would be:
“C:\Program Files\BJL\Scripts\ myinstaller.exe” Param1 Param2 Param3
Of course, POWERSHELL -COMMAND (executing program) would also work for the above, however because of the number of double quotes, the command would be
POWERSHELL -NoProfile -WindowStyle Hidden -ExecutionPolicyBypass -Command “& “”“C:\Program Files\BJL\Scripts\ myinstaller.exe””" -Param1 “”“value 1"”" -Param2 “”“value 1"”" -Switch3"
which is way too convoluted
Ah, ok. I can get this fixed up. I agree it should work as your describe.
Thanks, let me know when this is ready to test it.