1
votes

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.

2
The answer is the one you already know - the MSI itself must be launched with elevation, either as admin as you say, or with a program that elevates and then calls MsiInstallProduct or an equivalent launch method.PhilDW
@PhilDW Is there a way to display a warning message to the user if the msi is not launched with admin rights even before the welcome dialog is displayed? Also when the user right click on an msi the run as administrator option is not available.Santhosh
Why does that custom action require admin rights in the first place?zett42
display a warning message to the user if the msi is not launched with admin rights -- under a Fragment or Product element add <Condition Message="Launch installer with admin rights!">Privileged</Condition> ... see also.zett42
when the user right click on an msi the run as administrator option is not available -- wrap the .msi in a .exe that has a manifest with <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>. For that .exe you may create SFX with 7zip or use WiX Burn for example.zett42

2 Answers

0
votes

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.

0
votes

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.