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 run a powershell script from msi before install
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 15, 2017
09:25 AM
How to run a powershell script from msi before install
Hi,
I'm trying to run a PowerShell script before installing my application via the MSI package
I would like my script to run directly when the user is double clicking on the MSI
I have already tried to do this :
On Behavior and Logic -> Custom actions and Sequences
Custom actions -> New PowerShell -> Stored in Binary Table
On Common table :
PowerShell Script File Name -> Path to my ps1 script
Return Processing -> Synchronous (Check exit code)
In-Script Execution -> Immediate execution
Execution scheduling -> Always execute
Install Exec Sequence ->
But my script is not running when my MSI is launched
Did I forgot something ?
Thank you
I'm trying to run a PowerShell script before installing my application via the MSI package
I would like my script to run directly when the user is double clicking on the MSI
I have already tried to do this :
On Behavior and Logic -> Custom actions and Sequences
Custom actions -> New PowerShell -> Stored in Binary Table
On Common table :
PowerShell Script File Name -> Path to my ps1 script
Return Processing -> Synchronous (Check exit code)
In-Script Execution -> Immediate execution
Execution scheduling -> Always execute
Install Exec Sequence ->
But my script is not running when my MSI is launched
Did I forgot something ?
Thank you
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 15, 2017
10:00 AM
The Exec Sequence does not happen until you get all of the way through the UI Sequence. It sounds like you've got it scheduled to run in the wrong sequence for what you are wanting.
Try changing it to the UI Sequence instead.
Chad
Try changing it to the UI Sequence instead.
Chad
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 15, 2017
10:13 AM
chad.petersen wrote:
The Exec Sequence does not happen until you get all of the way through the UI Sequence. It sounds like you've got it scheduled to run in the wrong sequence for what you are wanting.
Try changing it to the UI Sequence instead.
Chad
I have already tryed to change the UI Sequence, it's not working
Any other idea ?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 17, 2017
07:35 AM
Ok, I found the problem (really strange by the way...)
My script was not working because it needed another script to work..
As my original script was not working, I created a new one (another powershell script) which was only displaying a form :
[CODE][System.Windows.Forms.MessageBox]::Show("My Custom Action","Hello", 0, 64)[/CODE]
I removed my original script from the sequences and I have been trying to run my test script at all positions in the UI and Exec sequences
With no success..
So, I tried to run my first script again, but I forgot to desactivate my test script
And, miraculously, it works !
I don't know if it is an Installshield problem or maybe a wrong defined or forgotten parameter
But the fact is, in order to run a powershell script (before install process in my case) follow these steps:
For the new script
1) Create a new Powershell custom action (in addition to your script)
2) In the common tab :
PowerShell Script File Name -> Path to an empty script ps1
Return Processing -> Synchronous (Check exit code)
In-Script Execution -> Immediate execution
Execution scheduling -> Always execute
Install UI Sequence ->
Install Exec Sequence ->
+ Install Exec Condition -> Not Installed
For your custom script
In the common tab :
PowerShell Script File Name -> Path to your script ps1
Return Processing -> Synchronous (Check exit code)
In-Script Execution -> Immediate execution
Execution scheduling -> Always execute
Install UI Sequence ->
Install Exec Sequence ->
+ Install Exec Condition -> Not Installed
If, for example, you add a form in the new script, it will not be executed, but allows the second one to run..
If someone has an explanation, feel free to share !
Thank you and enjoy
My script was not working because it needed another script to work..
As my original script was not working, I created a new one (another powershell script) which was only displaying a form :
[CODE][System.Windows.Forms.MessageBox]::Show("My Custom Action","Hello", 0, 64)[/CODE]
I removed my original script from the sequences and I have been trying to run my test script at all positions in the UI and Exec sequences
With no success..
So, I tried to run my first script again, but I forgot to desactivate my test script
And, miraculously, it works !
I don't know if it is an Installshield problem or maybe a wrong defined or forgotten parameter
But the fact is, in order to run a powershell script (before install process in my case) follow these steps:
For the new script
1) Create a new Powershell custom action (in addition to your script)
2) In the common tab :
PowerShell Script File Name -> Path to an empty script ps1
Return Processing -> Synchronous (Check exit code)
In-Script Execution -> Immediate execution
Execution scheduling -> Always execute
Install UI Sequence ->
Install Exec Sequence ->
+ Install Exec Condition -> Not Installed
For your custom script
In the common tab :
PowerShell Script File Name -> Path to your script ps1
Return Processing -> Synchronous (Check exit code)
In-Script Execution -> Immediate execution
Execution scheduling -> Always execute
Install UI Sequence ->
Install Exec Sequence ->
+ Install Exec Condition -> Not Installed
If, for example, you add a form in the new script, it will not be executed, but allows the second one to run..
If someone has an explanation, feel free to share !
Thank you and enjoy
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)