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.
Related
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.
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 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?
How can I launch an application with administrator rights after I have completed an installation using a WiX-based MSI?
I can launch the application just fine on Windows XP, but with Windows 7, it's an issue.
The application has a manifest embedded in it that says it should run as administrator and I've changed the impersonate attribute in the Custom Action to "no". I can't change the execute attribute to deferred, as this only works before the InstallFinalize action, and I need it after the user has clicked Finish in the MSI.
This is my custom action:
<CustomAction Id="LaunchApp" FileKey="App" ExeCommand="[Command Line Args]" Execute="immediate" Impersonate="no" Return="asyncNoWait" />
I couldn't use WixShellExec as I needed to pass in command line arguments if certain conditions were true. So I just created a custom action that launched the exe through cmd prompt. Hacky, but a viable workaround and it works without a hitch.