Unable to Silent Execute the Command in WiX Script - wix

Below is my code when i try to install my MSI it does everything but the lines below shows no sign of execution.
<Binary Id="unzipExeId" SourceFile="unzip.exe"/>
<Property Id="WixQuietExec64CmdLine" Value="[#$(var.InstallationLocation)\unzip.exe]"/>
<CustomAction Id="unzipAction" BinaryKey="unzipExeId" DllEntry="WixQuietExec64" Execute='deferred' Return ='asyncWait' Impersonate='no'/>
<InstallExecuteSequence>
<Custom Action='unzipAction' Before='InstallFinalize'/>
</InstallExecuteSequence>
Did I miss anything.
But When i Try this code
<Binary Id="unzipExeId" SourceFile="unzip.exe"/>
<CustomAction Id="unzipAction" BinaryKey="unzipExeId" ExeCommand="START /B unzip.exe" Execute='deferred' Return ='asyncWait' Impersonate='no'/>
<InstallExecuteSequence>
<Custom Action='unzipAction' Before='InstallFinalize'/>
</InstallExecuteSequence>
Everything Works Just Fine but the execution of the unzip.exe causes a pop up in the machine. The exe is not silently installed. But i need to silently execute the EXE.
Thanks in Advance

It could be related to DllEntry instead of using "WixQuietExec64" try to use "CAWixQuietExec64".
There is an open issue regarding this.
http://wixtoolset.org/issues/4802/
This is as a common use:
<CustomAction Id="CA_RunBatchScript"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="check" />

Related

How to add arguments to the custom action exe in Wix?

I am trying to execute an exe after installation. Below is how I am trying to do this.
<Property Id="WixShellExecTarget" Value="[#fil7D28AEF774656849395A2FA20A5C963D]" />
<CustomAction Id="LaunchMosquitto" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action="LaunchMosquitto" After="InstallFinalize" />
</InstallExecuteSequence>
In here, [#fil7D28AEF774656849395A2FA20A5C963D] refers to the file ID. I need to run this exe with the parameter " -c config.conf". How can I achieve this? Any help would be much appreciated. I need this to happen without a command prompt being launched.
Logs after the answer :
MSI (s) (D0:24) [18:32:16:273]: Executing op: ActionStart(Name=LaunchMosquitto,,)
MSI (s) (D0:24) [18:32:16:273]: Executing op: CustomActionSchedule(Action=LaunchMosquitto,ActionType=3137,Source=BinaryData,Ta rget=WixQuietExec64,CustomActionData="C:\Kube2.0\Mosquitto\mosquitto.exe" -c C:\Kube2.0\Mosquitto\mosquitto.conf)
As Yan suggested you should use a quiet CA.
<SetProperty Id="LaunchMosquitto" Value=""[#fil7D28AEF774656849395A2FA20A5C963D]" -c config.conf" Before="LaunchMosquitto" Sequence="execute"/>
<CustomAction Id="LaunchMosquitto"
BinaryKey="WixCA"
DllEntry="WixQuietExec64"
Execute="deferred"
Return="check"
Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="LaunchMosquitto" Before="InstallFinalize" />
</InstallExecuteSequence>

Immediate Execute of many Files after InstallInitialize

I want do execute many files after InstallInitialize but not deferred, because I can have no admin rights. Till now I used for one file the example of the documentation:
<Property Id="QtExecCmdLine" Value="command line to run"/>
<CustomAction Id="QtExecExample" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check"/>
<InstallExecuteSequence>
<Custom Action="QtExecExample" After="TheActionYouWantItAfter"/>
</InstallExecuteSequence>
But the problem is, that there is only one QtExecCmdLine property and I want to execute more files.
The only way I see is to use the deferred example from the documentation with two custom actions.
If the files you want to run change your system you must run them after InstallInitialize and before InstallFinalize.
You can set the Impersonate attribute to “yes” to run them as user who lunched the installer instead of the System user account
To run multiple executable files after Installinitialize:
1) Create CustomAction for each of them
<Fragment>
<CustomAction Id="MYEXE1"
FileKey="myexe1.exe"
ExeCommand="-u"
Execute="rollback"
Impersonate="yes"
Return="check">
</CustomAction>
<CustomAction Id="MYEXE2"
FileKey="myexe2.exe"
ExeCommand="-i"
Execute="deferred"
Impersonate="yes"
Return="check">
</CustomAction>
</Fragment>
2)Schedule the custom
<InstallExecuteSequence>
<Custom Action="MYEXE1" After="InstallInitialize">
<![CDATA[NOT Installed]]>
</Custom>
<Custom Action="MYEXE2" After="myexe1">
<![CDATA[NOT Installed]]>
</Custom>
</InstallExecuteSequence>

Two simultaneous EXE files running WiX

I have two custom actions running two EXE files. But they get extracted at the same time and the processes block each other during install. How do I schedule them one after the other?
<CustomAction Id="StartAppOnExit1"
FileKey="UMIEXE"
ExeCommand=""
Execute="deferred"
Return="asyncNoWait"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="StartAppOnExit1"
Before="InstallFinalize">$UMIEXE=3</Custom>
</InstallExecuteSequence>
<CustomAction Id="StartAppOnExit2"
FileKey="Python"
ExeCommand=""
Execute="commit"
Return="check"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action ="StartAppOnExit2"
After="StartAppOnExit1" >$Python=3</Custom>
</InstallExecuteSequence>
Here is my code, but I seem to be getting an error with what you told.
In product.wxs sequence them one after another and in custom action have a check to validate that the exe is executed and hold the process there only
<Custom Action="FirstCustomAction" After="InstallFinalize">NOT INSTALLED AND NOT REMOVE</Custom>
<Custom Action="SecondCustomAction" After="FirstCustomAction">NOT INSTALLED AND NOT REMOVE</Custom>
in CustomAction
WaitForExit() in process call.

WiX. Rollback custom action when is canceled installation

I have a custom action
<CustomAction Id="myActionId" BinaryKey="myAction" DllEntry="MySimpleAction" Execute="immediate" Return="check" />
<InstallExecuteSequence>
<Custom Action="myActionId" After="InstallInitialize">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>
My custom action does backup and resolved database. I need to do rollback (drop database) when is canceled installation.
I did:
<CustomAction Id="myActionId" BinaryKey="myAction" DllEntry="MySimpleAction" Execute="immediate" Return="check" />
<CustomAction Id="myActionRollbackId" BinaryKey="myActionRollback" DllEntry="MySimpleAction" Execute="rollback" Return="check" />
<InstallExecuteSequence>
<Custom Action="myActionId" After="InstallInitialize">CHECKBOXCOPYPROP=1</Custom>
<Custom Action="myActionRollbackId" Before="myActionId">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>
But I was having an error.
If I do like this:
<CustomAction Id="myActionId" BinaryKey="myAction" DllEntry="MySimpleAction" Execute="immediate" Return="check" />
<CustomAction Id="myActionRollbackId" BinaryKey="myActionRollback" DllEntry="MySimpleAction" Execute="immediate" Return="check" />
<InstallExecuteSequence>
<Custom Action="myActionId" After="InstallInitialize">CHECKBOXCOPYPROP=1</Custom>
<Custom Action="myActionRollbackId" After="myActionId">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>
My custom action myActionRollbackId works.
How to run rolback when is canceled installation?
Someone can help me?
The custom action which runs on install and does something with the database should be deferred (Execute='deferred'). Its corresponding rollback action should be Execute='rollback'. When you schedule these custom actions, the rollback action should go first.
Also, make sure the conditions are set properly.
Installation is always done in transaction. when you launch an installer, it first creates something called installation script which is like a to do list of what it will do while installation.
When we set some custom action as Execute="immediate", it gets executed immediately but when we set our action as Execute="deferred", it gets added in the installation script, hence rollback becomes easy for this.
Now one thing to note here is that we get access to session in Execute="immediate" mode, but we cannot access session in Execute="deferred" mode.
If we try to access session it will give error, which in this case might be the reason for your error...

Wix Open web page when uninstall completes

I'm using Wix3. I need to open a web page when the user uninstalls the product.
Any ideas how it can be done?
Thanks.
Here's a sample of the code we use, we don't actually set the URL at compile time, but update properties in the MSI post-build so this might seem a little "over engineered". We use the WiXShellExec CA and have an additional condition so that the webpage is only displayed during uninstall, and not during a major upgrade.
<Fragment>
<Property Id="MyURL"><![CDATA[http://www.blah.blah.blah/]]></Property>
<CustomAction Id="SetOpenURL" Property="WixShellExecTarget" Value="[MyURL]" />
<CustomAction Id="OpenURL" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore" />
<InstallExecuteSequence>
<!-- Launch webpage during full uninstall, but not upgrade -->
<Custom Action="SetOpenURL" After="InstallFinalize"><![CDATA[REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE]]></Custom>
<Custom Action="OpenURL" After="SetOpenURL"><![CDATA[REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE]]></Custom>
</InstallExecuteSequence>
</Fragment>
Add these XML elements somewhere under your <Product> element:
<CustomAction Id="LaunchBrowser"
ExeCommand="explorer.exe http://www.google.com"
Directory="INSTALLDIR"
Return="asyncNoWait" >
REMOVE="ALL"
</CustomAction>
<InstallExecuteSequence>
<Custom Action="LaunchBrowser" After="InstallValidate"/>
</InstallExecuteSequence>
The REMOVE="ALL" condition will make sure the custom action is executed only if the product is being completely removed.
The After="InstallValidate" makes sure that the custom action is executed right after the REMOVE property value becomes known.
The example provided by FireGiant Launch the Internet doesn't work for me but it inspire me to come out my own solution as below.
The condition NOT Installed mean new installation while Installed means it only trigger when uninstall.
<CustomAction Id="LaunchBrowser" Directory="INSTALLDIR" Return="asyncNoWait" ExeCommand="explorer.exe http://www.google.com/" />
<InstallExecuteSequence>
<Custom Action="LaunchBrowser" After="InstallFinalize">Installed</Custom>
</InstallExecuteSequence>
Here is what I did for both install and uninstall:
<Product>
...
<CustomAction Id="LaunchBrowserInstall" Directory="TARGETDIR" Execute="immediate" Impersonate="yes" Return="asyncNoWait" ExeCommand="explorer.exe https://www.example.com/post_install/" />
<CustomAction Id="LaunchBrowserUninstall" Directory="TARGETDIR" Execute="immediate" Impersonate="yes" Return="asyncNoWait" ExeCommand="explorer.exe https://www.example.com/post_uninstall/" />
<InstallExecuteSequence>
<Custom Action="LaunchBrowserInstall" After="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
<Custom Action="LaunchBrowserUninstall" After="InstallFinalize">REMOVE ~= "ALL"</Custom>
</InstallExecuteSequence>
...
</Product>