I'm creating an installer with Wix 3.10. This installer will need to execute a PowerShell script after the installation of the files.
To execute the PowerShell script I use the following:
<Component Id="AddUserInstallScript" Guid="{87DB934A-5ECF-4073-81F1-BA139F30A686}" Directory="PHONEMANAGER_FOLDER" >
<File Id="CreateADUserScript" Name="CreateADUser.ps1" Source="CreateADUser.ps1" KeyPath="yes"/>
</Component>
<Property Id="POWERSHELLEXE" Value="c:\Windows\System32\WindowsPowerShell\v1.0\powershell">
</Property>
<Condition Message="This application requires Windows PowerShell.">
<![CDATA[Installed OR POWERSHELLEXE]]>
</Condition>
<SetProperty Id="RunPSscriptCommand"
Before="RunPSscriptCommand"
Sequence="execute"
Value=""[POWERSHELLEXE]" -Version 3.0 -NonInteractive -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "&'[#CreateADUserScript]' -domainname '[SERVICE_USER_NETBIOSDOMAIN]' -password '[service_user_pwd]' -domainadminname '[DOMAIN_ADMINISTRATOR]' -domainadminpassword '[domain_administrator_pwd]' ; exit $$($Error.Count)" "
/>
<CustomAction Id="RunPSscriptCommand"
BinaryKey="WixCA"
DllEntry="WixQuietExec64"
Execute="deferred"
Return="check"
Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="RunPSscriptCommand" After="InstallFiles"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>
When I run the installer I'm getting the following error in the log file:
MSI (s) (10:F8) [09:54:54:515]: Invoking remote custom action.
DLL: C:\Windows\Installer\MSI80E7.tmp, Entrypoint: WixQuietExec64
WixQuietExec64: Error 0x80070001: Command line returned an error.
WixQuietExec64: Error 0x80070001: QuietExec64 Failed
WixQuietExec64: Error 0x80070001: Failed in ExecCommon method
CustomAction RunPSscriptCommand returned actual error code 1603
(note this may not be 100% accurate if translation happened inside sandbox)
On the destination machines is PowerShell 3 installed. The script also uses PowerShell 3 modules.
I have included the option -InputFormat None
but this makes no difference for PowerShell 3.
Any thoughts on this issue?
You can check your powershell version automatically using WixPSExtension.dll
<PropertyRef Id="POWERSHELLVERSION" />
<Condition Message="You must have PowerShell 1.0 or higher.">
<![CDATA[Installed OR POWERSHELLVERSION >= "1.0"]]>
</Condition>
I hope it will help.
User contributions licensed under CC BY-SA 3.0