(Partial) failure installing WiX-generated MSI from elevated command prompt - wix

As a test case for an issue I'm having with application deployment, I built an MSI following the WiX Simple Setup tutorial and using the latest version of WiX 3.5. My test environment is a virtual machine running 64-bit Window 7 Ultimate.
If I login as an standard user (no administrative privileges), open an elevated command prompt and install the MSI using msiexec /i testproj.msi, the directories and files are created, but the test program is not listed in the Programs and Features section of the Control Panel.
The test program installs completely if I run it from an elevated command prompt while logged in as a user with administrative privileges, or if I run it from a non-elevated command prompt. In all cases, the dialog that says "Please wait while Windows configures Test Package" is displayed.
I'm testing this in a virtual machine, reverting to a preinstall snapshot each time to make sure the failed installations aren't interfering.
I've enabled logging (e.g. msiexec /i testproj.msi /L*v test.log), and in all cases, the log indicates the program was installed with no errors (return code of 0).
Why does the installation fail to register the program in the Programs and Features list when run from an elevated command prompt while logged in as a standard user?

Install the application from normal user account and then check the Add/Remove program in the administrator account. The entry must be present there. This can occur if you haven't specified ALLUSERS value to 1.
<Property Id="ALLUSERS" Value="1" />

Related

Install ends prematurely with error "must be launched with administrative privileges."

I'm using Wix to create an installer to deploy a simple .NET 6 web API in IIS. When I launch the .msi it displays an error popup with the message "The [application] must be launched with administrative privileges." The only option is to click OK which advances the installer to the "Setup Wizard ended prematurely" page.
Since it's an .msi there's no Run as Administrator right-click menu option, though I can install my application from an Administrator command prompt. Is there a property I can set so that the installer either doesn't require administrator privileges or automatically executes with administrator privileges?
You can run it as administrator using comand prompt.
Or try this attributes for you package
<Package InstallPrivileges="elevated" InstallScope="perMachine">

Avoiding multiple UAC prompts during MSI installation

We have a msi installer which we have created using the wix installer. This installer also includes certain device drivers that need to be installed. We install the device drivers via a custom action. This custom action executes a .bat file that contains the utility dpinst64 to install the driver package. I have used the following option with the dpinst64
#if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
rem echo Installing driver from 64-bit installer on Windows 7
rem dpinst64.exe /SW /S /PATH W7
dpinst64.exe /q /se /PATH W7
) else if /I "%PROCESSOR_ARCHITECTURE%" == "X86" (
rem echo Installing driver from 32-bit installer on Windows 7
dpinst32.exe /q /se /PATH W7
)
)
What happens is when the user double clicks on the msi, the user gets a prompt to enter his / her credentials. After this installation proceeds OK. When the time comes to install the drivers, the user is again prompted with the credential window. I would like to know how can I avoid this coming again. I was thinking since I have already provided my credentials, this should remain for the rest of the session. However this seems to be not the case.
Batch Files Considered Harmful: Batch files must be avoided at all cost for MSI deployment. They are clunky, obsolete and almost without error handling and generally feature no rollback.
WiX Driver Element: Recommend you try to use the WiX Driver Element instead. It uses the DIFx framework under the hood - as far as I know. A small, practical example found on github.com.
Previous Answer: Maybe see this previous answer for more on the difx:Driver construct:
<Component>
<File ... />
<difx:Driver ... />
</Component>
Links:
https://developer.microsoft.com/en-us/windows/hardware
WiX silent install unable to launch built in .EXE: WiX v3
WiX silent install unable to launch built in .EXE: WiX v3
Can't seem to get Wix to install driver

Wix installer - Error 1925 in Silent or Passive mode, but works fine in interactvie

I have an MSI installer built with Wix. It does not require elevated privileges, having ALLUSERS=2 and MSIINSTALLPERUSER=1. It works fine in the user unteractive mode, but fails when launched from a non-elevated command prompt in the silent (/qn) or passive (/passive) mode.
The error in the log appearing straight after "Action start: InstallFinalize":
Error 1925. You do not have sufficient privileges to complete this installation for all users of the machine. Log on as administrator and then retry this installation.
Interestingly, if I run the installer from an admin command prompt in the silent mode, it succeeds. It installs into the per-user folder and writes registry to HKCU as expected, but when I uninstall it, it triggers the UAC elevation prompt, which suggests that there's some component there that has been installed per-machine, rather than per-user. Again, this does not happen if it was installed in the user-interactive mode.
Any help will be much appreciated.
It turned out that the problem was with the ALLUSERS property. I had a custom action that set its value either to 1 or nothing before FindRelatedProducts to match the scope of any previously installed version so that it can be properly upgraded. Then, there was another custom action that reset the value of ALLUSERS back to 2 and set MSIINSTALLPERUSER appropriately instead. The problem was with that second custom action - apparently you shouldn't reset the value of ALLUSERS to 2 in the InstallExecuteSequence, but it's fine to do so in InstallUISequence.

How to run WIX bootstrap built exe to run in silent mode?

Is it possible to run the exe built using WIX burn bootstrap to run in silent mode? I need to do this in order to skip the UAC prompt. Are there any better ways to skip the UAC prompt using the WIX project itself? Without making any changes to the registry keys manually.
Burn supports silent installations. Use the /quiet switch to run installation without any user interface. This will not show the UAC prompt.
AppInstaller.exe /install /quiet
If your installation requires elevated rights to install properly, run it from another already elevated process - either command line, or a management software.

Wix Installer: Error 1925 when using silent installer

In my wix setup, I use InstallScope="perMachine". In the interactive setup, there is no problem and it installs my application perfectly. However, when I try to install it from command line using /qn, I get the following error.
MSI (s) (60:EC) [11:51:05:268]: Product: ClickShare Launcher -- Error 1925. You do not have sufficient privileges to complete this installation for all users of the machine. Log on as administrator and then retry this installation.
Could anyone tell me why it gives such problem only in silent installation? Does command line have different user privileges?
Can I somehow detect if the user has required privileges and install the application perUser instead of perMachine? Would this be a solution?
Thanks.
You can try to set the install per user / per machine code as a parameter
C:\Users\xxxxx\Desktop>msiexec /i "program.msi" MSIINSTALLPERUSER=1 ALLUSERS=2 /qn
this helped us on a application that did NOT require admin priviledge on interactive, but did require admin priviledge on silent mode....
maybe it helps some other users in the future... (from google searches)
Starting with Windows Vista, MSI installs running from a standard user process requiring elevation cannot do so when running silent. This is due to UAC. Elevate the process prior to invoking msiexec.