Why is it that I can run the script in a dos box I.e. powershell.exe .\registerlicense.ps1 and it works ______________________ Steven Ogilvie
Sent from my BlackBerry... 3 - 45 Bertrand Street Ottawa, ON Canada K1M 1Y5 Mobile: +1 613 299-2121 E-mail: sogil...@msn.com -----Original Message----- From: "Edwin G. Castro [via Windows Installer XML (WiX) toolset]" <ml-node+s687559n7584125...@n2.nabble.com> Date: Tue, 5 Mar 2013 23:00:13 To: <sogil...@msn.com> Subject: Re: Running PowerShell script... Here's the bit that's important: CAQuietExec: Import-Module : Could not load file or assembly 'file:///C:\Program Files\MYCORP CAQuietExec: \MYCORP Services\Common\NServiceBus.Core.dll' or one of its dependencies. This a CAQuietExec: ssembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. This is telling you that the assembly you are trying to load is probably compiled against .NET 4 while PowerShell is loading the .NET 2 runtime. PowerShell v3 loads the .NET 4 runtime but PowerShell v2 still only loads the .NET 2 runtime. The easiest solution if you can manage it is to get NServiceBus.Core.dll compiled against the .NET 2 runtime (.NET 3.5 would work too). Otherwise you'll need to decide whether you'll only support PowerShell v3 OR create/customize a PowerShell.exe.config that allows PowerShell to load the .NET 4 runtime. Edwin G. Castro Software Developer - Staff Digital Channels Fiserv Office: 503-746-0643 Fax: 503-617-0291 www.fiserv.com > -----Original Message----- > From: StevenOgilvie [mailto:[hidden email] > </user/SendEmail.jtp?type=node&node=7584125&i=0> ] > Sent: Tuesday, March 05, 2013 2:14 PM > To: [hidden email] </user/SendEmail.jtp?type=node&node=7584125&i=1> > Subject: [WiX-users] Running PowerShell script... > > Hi guys > > I have googled and done everything I think I should have done but I am > getting a funky error in the MSI log file, has anyone else had this issue, if > so > how did you fix it? > > Install the Powershell file > <Component Id="cmp_RegisterNServiceBusLicense" > Guid="{276C369D-BF32-472F-A7FC-24155DEB18DE}"> > <File Id="file_RegisterNServiceBusLicense" KeyPath="yes" > Source="..\$(var.resourcePath)\RegisterLicense.ps1" /> > </Component> > > > Set the custom action > <CustomAction Id="CA_SetNServiceBusLicense" > Property="CA_NSERVICEBUSLICENSE" > Value =""[POWERSHELLEXE]" -Version 2.0 -NoProfile - > NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command > "& '[#file_RegisterNServiceBusLicense]' ; exit > $$($Error.Count)"" /> > <CustomAction Id="CA_NSERVICEBUSLICENSE" BinaryKey="WixCA" > DllEntry="CAQuietExec" Execute="deferred" Return="check" > Impersonate="no" /> > <UI> > <ProgressText Action="CA_NSERVICEBUSLICENSE">CA: Installing > NServiceBus license...</ProgressText> > </UI> > > Sequence the custom action > <InstallExecuteSequence> > <Custom Action="CA_SetNServiceBusLicense" > After="InstallValidate"></Custom> <Custom > Action="CA_NSERVICEBUSLICENSE" Before="InstallServices">NOT > Installed</Custom> > > Get the powershell path: > > <Property Id="POWERSHELLEXE"> > <RegistrySearch Id="POWERSHELLEXE" > Type="raw" > Root="HKLM" > > Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" > Name="Path" /> > </Property> > <Condition Message="This application requires Windows PowerShell."> > > </Condition> > > The powershell script itself is pretty basic: > C: > CD "C:\Program Files\MYCORP\MYCORP Services\Common" > Import-Module .\NServiceBus.Core.dll > Install-License -Path .\License.xml > > > The error in the msi logfile: > > Action 17:00:34: > CA_NSERVICEBUSLICENSE.CA23A0DC_B2DE_4F2C_9E74_FD373F99E9D7. > CA: Installing NServiceBus license... > MSI (s) (5C:48) [17:00:34:296]: Executing op: > CustomActionSchedule(Action=CA_NSERVICEBUSLICENSE.CA23A0DC_B2DE_ > 4F2C_9E74_FD373F99E9D7,ActionType=3073,Source=BinaryData,Target=CAQ > uietExec,CustomActionData="C:\Windows\System32\WindowsPowerShell\v > 1.0\powershell.exe" > -Version 2.0 -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy > Bypass -Command "& 'C:\Program > Files\MYCORP\MYCORPServices\Common\RegisterLicense.ps1' ; exit > $($Error.Count)") > MSI (s) (5C:64) [17:00:34:317]: Invoking remote custom action. DLL: > C:\Windows\Installer\MSI8EA2.tmp, Entrypoint: CAQuietExec > CAQuietExec: Entering CAQuietExec in C:\Windows\Installer\MSI8EA2.tmp, > version 3.7.1224.0 > CAQuietExec: > "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" > -Version 2.0 -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy > Bypass -Command "& 'C:\Program Files\MYCORP\MYCORP > Services\Common\RegisterLicense.ps1' ; exit $($Error.Count)" > CAQuietExec: Import-Module : Could not load file or assembly > 'file:///C:\Program Files\MYCORP > CAQuietExec: \MYCORP Services\Common\NServiceBus.Core.dll' or one of > its dependencies. This a > CAQuietExec: ssembly is built by a runtime newer than the currently loaded > runtime and cannot be loaded. > CAQuietExec: At C:\Program Files\MYCORP\MYCORP > Services\Common\RegisterLicense.ps1:5 char:14 > CAQuietExec: + Import-Module <<<< .\NServiceBus.Core.dll + CategoryInfo > : NotSpecified: (:) , BadImageFormatException > CAQuietExec: + FullyQualifiedErrorId : > System.BadImageFormatException,Microsoft.PowerShell.Commands.Import > ModuleCommand > CAQuietExec: > CAQuietExec: Install-License : The term 'Install-License' is not recognized > as > the name of a > CAQuietExec: cmdlet, function, script file, or operable program. Check the > spelling of the > CAQuietExec: name, or if a path was included, verify that the path is > correct > and try again. > CAQuietExec: At C:\Program Files\MYCORP\MYCORP > Services\Common\RegisterLicense.ps1:6 char:16 > CAQuietExec: + Install-License <<<< -Path .\License.xml > CAQuietExec: + CategoryInfo : ObjectNotFound: > (Install-License:String) , Com > CAQuietExec: mandNotFoundException > CAQuietExec: + FullyQualifiedErrorId : CommandNotFoundException > CAQuietExec: > CAQuietExec: Error 0x80070002: Command line returned an error. > CAQuietExec: Error 0x80070002: CAQuietExec Failed CustomAction > CA_NSERVICEBUSLICENSE.CA23A0DC_B2DE_4F2C_9E74_FD373F99E9D7 > returned actual error code 1603 (note this may not be 100% accurate if > translation happened inside sandbox) > > thanks, > > Steve > > > > > -- > View this message in context: http://windows-installer-xml-wix- > toolset.687559.n2.nabble.com/Running-PowerShell-script-tp7584122.html > Sent from the wix-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > > Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester > Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the > endpoint security space. For insight on selecting the right partner to tackle > endpoint security challenges, access the full report. > http://p.sf.net/sfu/symantec-dev2dev > _______________________________________________ > WiX-users mailing list > [hidden email] </user/SendEmail.jtp?type=node&node=7584125&i=2> > https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ WiX-users mailing list [hidden email] </user/SendEmail.jtp?type=node&node=7584125&i=3> https://lists.sourceforge.net/lists/listinfo/wix-users ---------------- If you reply to this email, your message will be added to the discussion below: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Running-PowerShell-script-tp7584122p7584125.html To unsubscribe from Running PowerShell script..., click here <http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7584122&code=c29naWx2aWVAbXNuLmNvbXw3NTg0MTIyfC0xMzAxOTI3MzMx> . NAML <http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> -- View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Running-PowerShell-script-tp7584122p7584127.html Sent from the wix-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users