cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
timstspry
Level 7

How to pass parameters to a powershell custom action?

I would like to utilize the new custom action type of powershell. However, most powershell scripts that I write need to have some sort of parameters passed to them. I do not see anywhere in the InstallShield documentation how to do this. Does anybody know how?

Thanks in advance!
Labels (1)
0 Kudos
(2) Replies
jesse_wolfe
Level 3

Tim,

I have not used the powershell custom action yet... when did it come out? What versions of MSI support it?

A couple of things... I use powershell exclusively in my custom actions, and I do plenty of parameter passing. I just use the executable CA type. It seems to work fine. Here's a sample invocation that I use:

[code]
cmd /C powershell -Command .\utilities\powershell\install\patch_install.ps1 -installCmd uninstall -productVersion [ProductVersion] 2>&1 > PatchUninstall[CLIENTPROCESSID]_log.txt
[/code]

I also know from using PowerShell with TeamCity, which has a PowerShell plug-in which forces you to use the "-Command -" idiom to take the script from standard in, that you can pass in values via environment variables as well. Is there a way to set some env vars?

Good Luck,

Jesse
0 Kudos
timstspry
Level 7

Hi Jesse, this capability was introduced in InstallShield 2012 spring. I assume it is only supported in that version and up of InstallShield. It would be a very handy and cool feature to use if they only explained how to pass parameters! 🙂 Without that information, it is pretty much useless in my humble opinion.

Take care,
0 Kudos