I am trying to run a bat file in background while installing an app using WIX. For this I used WixSilentExecCmdLine but after writing this code sniphet Installationitself failed.
<Property Id="WixSilentExecCmdLine" Value="C:\SampleWix\myBat.bat" Hidden="yes"/>
<CustomAction Id="SilentExecExample" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="check"/>
<InstallExecuteSequence>
<Custom Action="SilentExecExample" Before="InstallFinalize"/>
</InstallExecuteSequence>
Light Command
%WIX_LIGHT% %INSTALLER_BUILD_DIR%\*.wixobj -o %OUTPUT_DIR%\%MSI_OUTPUT_FILE_NAME% -ext WixUIExtension -ext WixUtilExtension.dll
You will not be able to run another parallel install while in the ExecuteSequence. Windows installer has a limitation that only one install can be in the ExecuteSequence at one time.
Please see this thread.
Related
Here I have tried something but it dose not work at all can anyone guide me how to run the multiple scripts from installer
<SetProperty Id="PS1"
Before="PS1"
Sequence="execute"
Value =""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"-NoLogo -NonInteractive -ExecutionPolicy Bypass -InputFormat None -NoProfile -File "-Command "cd '[INSTALLLOCATION]'; & '[#ps1]' ; exit $$($Error.Count)"" />
<CustomAction Id="PS1"
BinaryKey="WixCA"
DllEntry="WixQuietExec"
Execute="deferred"
Return="check"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="PS1" After='InstallFiles'>
<![CDATA[NOT Installed]]>
</Custom>
</InstallExecuteSequence>
to destination folder files get copied but it said like this why I dont know ,Inside a log file it shows like this
WixQuietExec: Processing -File '-Command cd' failed because the file does not have a '.ps1' extension. Specify a valid Windows PowerShell script file name, and then try again.
WixQuietExec: Windows PowerShell
WixQuietExec: Copyright (C) Microsoft Corporation. All rights reserved.
WixQuietExec:
WixQuietExec: Try the new cross-platform PowerShell https://aka.ms/pscore6
WixQuietExec:
WixQuietExec: Error 0xfffd0000: Command line returned an error.
WixQuietExec: Error 0xfffd0000: QuietExec Failed
WixQuietExec: Error 0xfffd0000: Failed in ExecCommon method
CustomAction PS1 returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
This doesn't always happen, but the error message is pretty clear. Here it is word-wrapped, so it is easier to read:
WixQuietExec: Processing -File '-Command cd' failed because
the file does not have a '.ps1' extension.
Specify a valid Windows PowerShell script file
name, and then try again.
That's a PowerShell error message.
I want to create an installer for a customized elasticsearch using WIX. When I use <CustomAction> to run elasticsearch-service.bat I get 1721 error. (I know that it is an antipattern to run bat files in your installer. But it seems the easiest way to install an elasticsearch service.)
<CustomAction Id="InstallService" Directory="elasticsearch" Execute="deferred" Impersonate="no" ExeCommand='"[elasticsearch]bin\elasticsearch-service.bat" install' Return="check" />
Also when I use <SerivceInstall> to create a service from elasticsearch-service-x64.exe, the service does not installed correctly and I can not start it. What is the best solution for doing this task?
I have a WiX installer that needs to run a Powershell script after install. I've gotten to the point where the installer does in fact run the script with this:
<SetProperty Id="RunStartScript"
Before ="RunStartScript"
Sequence="execute"
Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NonInteractive -ExecutionPolicy Bypass -InputFormat None -NoProfile -File "[INSTALLDIR]Scripts/Start.ps1"" />
<CustomAction Id="RunStartScript" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action="RunStartScript" Before="InstallFinalize">NOT Installed OR UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
However, the msi fails with this error:
The script 'Start.ps1' cannot be run because it contains a "#requires" statement for running as Administrator. The current Windows PowerShell session is not running as Administrator. Start Windows PowerShell by using the Run as Administrator option, and then try running the script again.
The installer already prompts for an Administrator before install begins, so I assumed the PowerShell command would be running as an admin already, this must not be the case.
I've found some answers that involve adding code to the start of a script to check for Admin privileges and to pass the command and args along to an Admin session, but I was looking for the possibility of another option as this is a signed script that someone else provided so any changes to it would have to go back to them for re-signing.
Needed to change Impersonate="yes" to Impersonate="no" so that the Powershell session wasn't ran as the normal user.
I have an application that includes a shell that is displayed for all non-admin users. During installation the shell needs to be closed. However if anything goes wrong during installation, I would like the shell to be restarted via a custom action. For legacy reasons, I accomplish both the close and the restart via C# custom actions. Here is the WiX code:
<CustomAction Id="CA_StopShell" ... Execute="deferred" Impersonate="no"/>
<CustomAction Id="CA_StartRollbackShell" ... Execute="rollback" Impersonate="yes"/>
<InstallExecuteSequence>
<Custom Action="CA_StartRollbackShell" Before="CA_StopShell"> </Custom>
<Custom Action="CA_StopShell" After="ProcessComponents" />
</InstallExecuteSequence>
This works fine, but it also brings up the shell for the admin user when there is an install failure, which is bad. The question is how do I make the custom action only occur if the user was not the Admin user?
I tried:
<Custom Action="CA_StartRollbackShell" Before="CA_StopAllAADProcesses"> NOT Privileged </Custom>
But that didn't ever start the shell back up.
FYI, I'm using Wix 3.8.
Thanks for any help you can give.
I am creating an Installer using WiX, and as part of this I am installing Oracle also.
I am using CA for doing this. But it fails without executing.
<CustomAction Id="InstallORA" ExeCommand="[ORACLE]start-oraclexe-install.bat" Directory="ORACLE" Execute="deferred" Return="check" Impersonate="no" />
My bat file content is:
C:\xe-10.2.0.1-nt.exe /s /f1"C:\OracleXE-install.iss" /f2"C:\oraclexe-setup.log"
In logs I see MSI (s) (44:9C) [12:18:42:344]: Running as a service. after this it pops an error message.
Any ideas how to fix it?