This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: How to pass parameters to a powershell custom action?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Sep 26, 2012
05:48 PM
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!
Thanks in advance!
(2) Replies
‎Sep 26, 2012
08:57 PM
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
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
‎Sep 27, 2012
10:28 AM
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,
Take care,