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 catch powershell errors in Installscript through LaunchAppandWait
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
‎Jan 16, 2018
10:49 AM
How to catch powershell errors in Installscript through LaunchAppandWait
Hello Friends,
I am trying to run a powershell script through LaunchAppandWait.
I want to catch the errors incase this powershell script fails.
But the problem is: the nResult = LAAW_PARAMETERS.nLaunchResult; always returns 0 even when the powershell script failed.
How to handle this case.
I have to fail the installer whenever this powershell script fails.
And i have to run this script through installscript only due to some dependency.
Any ideas?? Please help
Thanks
I am trying to run a powershell script through LaunchAppandWait.
I want to catch the errors incase this powershell script fails.
But the problem is: the nResult = LAAW_PARAMETERS.nLaunchResult; always returns 0 even when the powershell script failed.
How to handle this case.
I have to fail the installer whenever this powershell script fails.
And i have to run this script through installscript only due to some dependency.
Any ideas?? Please help
Thanks
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 16, 2018
11:29 AM
nResult only tells you if the 'Launch' was successful.
You will need to use something else to detect pass/fail of the PS script.
One way to accomplish is to write a temporary value to the registry in PS and interrogate that in IS.
You will need to use something else to detect pass/fail of the PS script.
One way to accomplish is to write a temporary value to the registry in PS and interrogate that in IS.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 16, 2018
11:40 AM
rguggisberg wrote:
nResult only tells you if the 'Launch' was successful.
You will need to use something else to detect pass/fail of the PS script.
One way to accomplish is to write a temporary value to the registry in PS and interrogate that in IS.
One could do it that way, if you're in control of the scripts. (You may not always have that option, and be forced to consume them verbatim for whatever reason)
The problem with Powershell is that you are going to want to parse the stderr stream from the process, which AFAIK you can't do from Installscript. I'd personally switch to a C# based custom action for launching the Powershell, because there's .Net classes for hosting Powershell scripts in managed code.
I haven't worked with it, but there may be some way of doing this as well with the native Powershell Custom Action support.
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)