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

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">

Related

I'm an admin (Windows 10 Home) and am told I don't have the authorization to uninstall an app I just installed. How do I uninstall it?

I'm using an Administrator account. I can install an MSI for the current user only, but when I try to uninstall it, I get the error message
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.
The three ways I tried to uninstall the app:
From both a regular powershell and a run-as-admin powershell:
msiexec /x MyFile.msi
Just run ./MyFile.msi and choose the Remove option
Run appwiz.cpl and choose to uninstall MyFile.
I suspect all three paths are to the same function that's failing. How can I delete this app?
If it's relevant, MyFile.msi was built with Wix.
The Wix file from which the MSI was generated was flawed.
Fixed by using Orca to edit the MSI, and adding AND NOT REMOVE to the SetALLUSERS and SetMSIINSTALLPERUSER tasks for the InstallExecuteSequence and InstallUISequence things.
Thanks for offering an answer though, Vivek.

Run wix immediate custom action with elevated privileges

We are populating the IIS websites to a drop down list based on the instructions provided here: Bind IIS local websites in dropdown list of wix installation?
The custom action works when the msi is launched from admin command prompt, however there is a failure when the msi is launched with out admin rights. Having the Impersonate value to no in the CA does not elevate the custom action execution with administrator privileges.
Is there a way to launch the msi with administrator privileges? How to execute immediate custom action in UI sequence with elevated access rights?
Thanks.
It's unfortunate that the IIS API (ServerManager class in .NET) requires elevation. What I do in this situation is create a bootstrapper for the MSI and mark it to require elevation.
In order to resolve the issue of running the Immediate custom action with admin rights, we had to embed the msi into an exe and display the error message if exe is not run as administrator.
ChilKat Zip 2 Secure Exe creator software was used to create an exe. https://www.chilkatsoft.com/chilkatsfx.asp
Added the following snippet in wix project: <Condition Message="Launch installer with admin rights!">Privileged</Condition> in order to display error message if the it is run in non admin mode.

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.

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

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" />