WIX: Run MSI repair mode in Elevated mode - wix

I have a WIX MSI and it is installing sucessfully . But I need to provide elevated privilege during the Repair mode. How it is achived using WIX

Resolved it myself by adding the following property
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />

Related

Unable to prompt for reboot after installation with Wix Bootstrapper project

I have a Wix Project and also a Bootstrapper. I want to prompt the user to restart after the last MSI is run.
Here is the Bootstrapper-
<Chain>
<MsiPackage SourceFile=".\Some.msi" Compressed="yes" />
<MsiPackage Id="MyMsi"
Compressed="yes"
Cache="no"
DisplayInternalUI="yes"
SourceFile="$(var.MyInstaller.TargetPath)"
Visible="no"/>
</Chain>
In my MSI, I have -
<Property Id="REBOOT" Value="Force"/>
and
<InstallExecuteSequence>
<ScheduleReboot After='InstallFinalize'>NOT REMOVE</ScheduleReboot>
</InstallExecuteSequence>
But the prompt doesn't show up. In the log I can find these lines-
Property(S): MsiRebootActionScheduled = 1
MSI (s) (40:64) [23:52:23:990]: Value of RebootAction property is 1
MSI (s) (40:64) [23:52:23:990]: Windows Installer requires a system restart. Product Name: XXX x64 Installer v3.0.0.0. Product Version: 3.0.0.0. Product Language: 1033. Manufacturer: XXX. Type of System Restart: 2. Reason for Restart: 2.
MSI (s) (40:64) [23:52:23:990]: Product: XXX x64 Installer v3.0.0.0. Restart required. The installation or update for the product required a restart for all changes to take effect. The restart was deferred to a later time.
Any suggestion on how to make this work?
I would remove the reboot code from your MSIs and just add the one into the bootstrapper. Adding reboot into bootstrapper was answered on this previous question.

Can Windows installer install two msi files at the same time? [duplicate]

This question already has answers here:
Wix and .NET Framework (prerequisites)
(5 answers)
Closed last month.
I have a msi installation package made by WIX, which automatically installs IIS Express 10.0 after the installation.
<Binary Id="myCustomActionsDLL" SourceFile="$(var.CustomAction.TargetDir)CustomAction.CA.dll" />
<CustomAction Id="CheckIISExpressStatus" BinaryKey="myCustomActionsDLL" DllEntry="CheckIISExpressStatus" Execute="immediate" Return="check" Impersonate="yes"/>
<CustomAction Id="InstallIISExpress" BinaryKey="myCustomActionsDLL" DllEntry="InstallIISExpress" Execute="immediate" Return="ignore" Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action="CheckIISExpressStatus" After="InstallFinalize" Overridable="yes">NOT Installed</Custom>
<Custom Action="InstallIISExpress" After="CheckIISExpressStatus" Overridable="yes">NOT Installed AND IS_INSTALL_IISEXPRESS="1"</Custom>
</InstallExecuteSequence>
In the InstallIISExpress action, I call bat to perform the installation.
msiexec /i iisexpress_amd64_en-US.msi /qb
But during execution, the Windows Installer prompts the error:
Other programs are being installed, please wait for the installation to complete, and then try again to install the software.
What parameters can I set to allow msi to install two msi at the same time?
You must not run other setups from a custom action within your main MSI. Instead you should run MSI files in sequence using a bootstrapper such as WiX's Burn feature.
It is late. I tried to write a proper explanation of this at one point, maybe see if it makes sense to you: Wix - How to run/install application without UI.
To summarize: running legacy setup.exe files from a custom action in your MSI will not be reliable, and running MSI files - whether directly or embedded in a setup.exe will positively not work because Windows Installer does not allow concurrent MSI installation sequences. A mutex is set when InstallExecuteSequence runs, and no other InstallExecuteSequence can be run while it is in effect. Concurrent MSI installations are forbidden and technically impossible.

Execute MSI package as User administration using WIX

I have created MSI package using Wix.
Wix Script:
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />
<CustomAction Id="InstallDRV" Directory="INSTALLDIR" Execute="deferred" ExeCommand="[INSTALLDIR]setup.exe" Impersonate="no" Return="check" />
This 'setup.exe' will be installing 'Printer' drivers and set as default printer.
So, this will be update the default printer in the below key.
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
But, msiexec.exe is running in 'System Administrator' instead of 'User Administrator'.
How can we execute MSI as 'User Administrator' account.
Thanks in advance.
Regards,
Dileep
It is normal for per machine "Everyone" installs to run with the system account so that they can run elevated. Also, there is little support in Windows Installer for running elevated custom actions with the installing user's credentials. The way that people solve this problem is primarily to do this kind of "install within an install" in some other way that does not involve custom actions. But try this:
The custom action needs to be impersonate="yes" so that it impersonates the installing user.
Elevate the entire MSI install by starting from an exe that elevates to administrator privilege and then starts the MSI.

Is there a way to run uninstallers from an installer in WiX?

I have a WiX based installer for a suite of applications. It replaces a bunch of old installers where each application in the suite had its own InstallShield based installer.
I would like the WiX installer to find any old InstallShield based installations and run their respective uninstallers. I have tried this:
<Property Id="OLD_APPLICATION_A_UNINSTALLSTRING">
<RegistrySearch Id="OldAppAUninstallString" Root="HKLM"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{$(var.OldAppAInstallerGUID)}"
Name="UninstallString" Type="raw"/>
</Property>
<InstallExecuteSequence>
<Custom Action="UninstallAppA" Before="InstallInitialize">
NOT Installed AND OLD_APPLICATION_A_UNINSTALLSTRING
</Custom>
</InstallExecuteSequence>
<CustomAction Id="UninstallAppA" Directory="System32"
ExeCommand="[OLD_APPLICATION_A_UNINSTALLSTRING] /qn" Execute="immediate" Return="check"/>
This results in a failed installation and error status 1618: "Another installation is already in progress. Complete that installation before proceeding with this install." Only one other installation is in progress, this installation...
Is there a way to run uninstallers from an installer in WiX?
I also have a bootstrapper and maybe I should run these uninstallations from there somehow. But I want to run them as late as possible in case the user cancels the installation. If that happens it doesn't look too good if the old application suite is gone...
In MSI there is a mutex that prevents two installation transactions (execute sequence) running at the same time hence your error.
You can use additional Upgrade elements to seek them out by UpgradeCode / Version / Lanugage and cause their removal during your installation transaction.

Burn - MsiPackage and Impersonation

I have an msi that allows the user to conditionally launch the installed application. The msi was created with Wix and includes the following xml statement:
<CustomAction Id='LaunchApplication' FileKey='foo.exe' ExeCommand='' Return="asyncNoWait" Impersonate="yes" />
The msi runs elevated, but the Impersonate option guarantees that the application is launched as the installing user.
The msi is included in my Burn package using the following statement:
<MsiPackage Id="FooMsi" SourceFile="$(var.Installer.TargetPath)" DisplayInternalUI="yes" Vital="yes" Permanent="no" />
However, Burn is elevated before the msi runs and therefore runs the application as Administrator.
Is there an impersonation option for Burn or do I have to launch the application from Burn instead?
Burn launches per-machine packages from an elevated helper process so MSI impersonates the elevated user. There's no way to tell MSI to impersonate another user and/or different permissions. You can use the LaunchTarget attribute of the WixStandardBootstrapperApplication element to launch a process from the unelevated Burn process.