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: Run Powershell in Basic MSI Project
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
‎Sep 23, 2010
10:15 PM
Run Powershell in Basic MSI Project
Hello, I need to run a powershell script .ps1 file in a basic MSI project. Anybody have any experience doing this? I have run lots of .cmd files using launchappandwait but I don't think PowerShell is the same animal 🙂
Thanks!
Thanks!
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 07, 2010
07:53 AM
I have the same need and would really like to know the recommended way for doing this. I also verified that LaunchAppAndWait doesn't indeed work with PowerShell scripts.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 07, 2010
09:29 PM
You may be able to get it to run by putting the powershell script in the Behavior and Logic -> Support Files - and launching it from a Custom Action using the powershell.exe. This is only going to work on machines with powershell installed though. The installer will fail on any machine without powershell. This seems risky to me.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 08, 2010
12:56 AM
destek wrote:
This is only going to work on machines with powershell installed though. The installer will fail on any machine without powershell. This seems risky to me.
I understand the risks, but as the given feature requires SharePoint 2010, having PowerShell present is not a problem as the SharePoint installer makes sure that PowerShell is installed and the platforms it runs on usually have it installed anyway.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 08, 2010
07:47 AM
Hmm, this is turning out to be complicated. If the script is located in support files, PowerShell chokes on the curly braces in the SUPPORTDIR path no matter how I try to escape them.
And if I can get the path issue sorted out, then there's the security settings of the target computer. When I ran a PowerShell script from another folder, it told me that the script needs to be signed (doable but awkward) or the script security settings changed (something you shouldn't do from an installer). Sigh.
And if I can get the path issue sorted out, then there's the security settings of the target computer. When I ran a PowerShell script from another folder, it told me that the script needs to be signed (doable but awkward) or the script security settings changed (something you shouldn't do from an installer). Sigh.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 08, 2010
10:12 PM
I have not gotten it to work either, but have made some progress on it. I am not sure what you mean by powershell chokes on the curly braces in the path? How are you trying to run powershell? I think if it were me, I would revert back to using LaunchApplication and execute powershell.exe piping in the powershell commands you want as parameters.
One thing that must absolutely be done prior to executing LaunchApplication is executing this command:
Disable(WOW64FSREDIRECTION);
Once control has returned back to IS from PowerShell, you would run this command:
Enable(WOW64FSREDIRECTION);
Hope this helps you out!
Tim
One thing that must absolutely be done prior to executing LaunchApplication is executing this command:
Disable(WOW64FSREDIRECTION);
Once control has returned back to IS from PowerShell, you would run this command:
Enable(WOW64FSREDIRECTION);
Hope this helps you out!
Tim
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 09, 2010
12:39 AM
timstspry wrote:
I have not gotten it to work either, but have made some progress on it. I am not sure what you mean by powershell chokes on the curly braces in the path? How are you trying to run powershell? I think if it were me, I would revert back to using LaunchApplication and execute powershell.exe piping in the powershell commands you want as parameters.
One thing that must absolutely be done prior to executing LaunchApplication is executing this command:
Disable(WOW64FSREDIRECTION);
Once control has returned back to IS from PowerShell, you would run this command:
Enable(WOW64FSREDIRECTION);
Hope this helps you out!
Tim
Thanks for the tip on the WOW64FSREDIRECTION, I'll check it out. What I meant about curly braces is that PowerShell doesn't seem to like any GUIDs in the path, and if the script is stored in support files, it ends up in the SUPPORTDIR, which in turn has the product code in the path. Even when running from the command line, scripts that have a GUID in their path fail to run due to a parse error. So far I haven't found a way to escape those curly braces in a way that would make PowerShell understand them.
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)