In the past I have experienced the same PowerShell hang you are describing but 
in my experience I never saw any changes made to the system. My tests occurred 
before CAQuietExec64 existed so I don't know if using CAQuietExec64 would allow 
the scripts to actually execute now.

I was going to suggest that you use the -NonInteractive parameter but I see you 
are already using it. I'll try to reproduce the problem on my end. Are you 
installing a 32-bit MSI on a 64-bit OS?

Edwin G. Castro
Software Developer - Staff
Electronic Banking Services
Fiserv
Office: 503-746-0643
Fax: 503-617-0291
www.fiserv.com
Please consider the environment before printing this e-mail


> -----Original Message-----
> From: Ryan Taylor [mailto:rtay...@penbaysolutions.com]
> Sent: Tuesday, November 09, 2010 2:13 PM
> To: wix-users@lists.sourceforge.net
> Subject: [WiX-users] Silently executing a PowerShell script from WiX Hangs
> PowerShell
> 
> Note: This question is also posted at
> http://stackoverflow.com/questions/4138324/silently-executing-a-
> powershell-script-from-wix-hangs-powershell.
> 
> I am trying to silently execute a PowerShell script from a WiX produced MSI.
> However, anytime I run the installer PowerShell hangs. This in turn hangs the
> installation process. PowerShell is running the script "properly" in that the
> script is able to make changes to the system and no errors are reported.
> Interestingly, if I kill the PowerShell process via Task Manager, the 
> installer
> cancels the installation and rolls back any changes.
> 
> --------------------------------------------------------------------------------
> My PowerShell Script
> --------------------------------------------------------------------------------
> # @param website The website under which the module should be compiled
> and registered.
> # @param name The name of the module to be registered.
> # @param assembly The assembly name, version, culture and public key
> token to be compiled.
> # @param assemblyType The fully qualified assemebly type to be registered.
> 
> param([string]$website = "website", [string]$name = "name",
> [string]$assembly = "assembly", [string]$assemblyType= "assemblyType")
> 
> import-module webadministration
> add-webconfiguration /system.web/compilation/assemblies
> "IIS:\sites\$website" -Value @{assembly="$assembly"} new-
> webmanagedmodule -Name "$name" -Type "$assemblyType" -PSPath
> "IIS:\sites\$website"
> --------------------------------------------------------------------------------
> 
> Wix Custom Action Contents : Attempt 1
> My first attempt at this was to use the & special character to execute the
> script
> --------------------------------------------------------------------------------
> <CustomAction Id="RegisterHttpModulePSCmd"
>               Property="RegisterHttpModulePowerShellProperty"
> 
> Value="&quot;C:\Windows\system32\WindowsPowerShell\v1.0\powershell
> .exe&quot; &amp;'C:\Program Files (x86)\My Company\Scripts\register-
> httpmodule.ps1' -website 'Default Web Site' -name 'MyCustomModule' -
> assembly 'MyCompany.Product.Feature, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=xxxxxxxxxxxxxxxx' -assemblyType
> 'MyCompany.Product.Feature.MyModule'"
>               Execute="immediate" />
> 
> <CustomAction Id="RegisterHttpModulePowerShellProperty"
>               BinaryKey="WixCA"
>               DllEntry="CAQuietExec64"
>               Execute="deferred"
>               Return="check"
>               Impersonate="no" />
> 
> <InstallExecuteSequence>
>    <Custom Action="RegisterHttpModulePSCmd" After="CostFinalize">NOT
> Installed</Custom>
>    <Custom Action="RegisterHttpModulePowerShellProperty"
> After="InstallFiles">NOT Installed</Custom> </InstallExecuteSequence>
> --------------------------------------------------------------------------------
> 
> Wix Custom Action Contents : Attempt 2
> My second attempt was to use the -File argument to execute the script.
> --------------------------------------------------------------------------------
> <CustomAction Id="RegisterHttpModulePSCmd"
>               Property="RegisterHttpModulePowerShellProperty"
> 
> Value="&quot;C:\Windows\system32\WindowsPowerShell\v1.0\powershell
> .exe&quot; -NoLogo -NonInteractive -NoProfile -File &quot;C:\Program Files
> (x86)\My Company\Scripts\register-httpmodule.ps1&quot; -website
> &quot;Default Web Site&quot; -name &quot;MyCustomModule&quot; -
> assembly &quot;MyCompany.Product.Feature, Version=1.0.0.0,
> Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx&quot; -assemblyType
> &quot;MyCompany.Product.Feature.MyModule&quot;"
>               Execute="immediate" />
> 
> <CustomAction Id="RegisterHttpModulePowerShellProperty"
>               BinaryKey="WixCA"
>               DllEntry="CAQuietExec64"
>               Execute="deferred"
>               Return="check"
>               Impersonate="no" />
> 
> <InstallExecuteSequence>
>    <Custom Action="RegisterHttpModulePSCmd" After="CostFinalize">NOT
> Installed</Custom>
>    <Custom Action="RegisterHttpModulePowerShellProperty"
> After="InstallFiles">NOT Installed</Custom> </InstallExecuteSequence>
> --------------------------------------------------------------------------------
> 
> Both approaches seem to work as they make modifications to the desired
> web.config file, however, both approaches hang PowerShell and thus the
> installer.
> 
> How do I silently execute a PowerShell script from Wix without hanging
> PowerShell?
> 
> Ryan Taylor
> Office (207)-504-5294
> rtay...@penbaysolutions.com
> www.penbaysolutions.com
> 
> 
> 
> CONFIDENTIALITY NOTICE:
> This e-mail message, including any attachments, is for the sole use of the
> intended recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or distribution is
> prohibited. If you are not the intended recipient, please do not read,
> disclose, reproduce, distribute, disseminate or otherwise use this
> transmission, but contact the sender by reply e-mail and destroy all copies of
> the message and its attachments.
> 
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a Billion"
> shares his insights and actions to help propel your business during the next
> growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to