Santhosh
Santhosh

Reputation: 751

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.

Upvotes: 2

Views: 2584

Answers (2)

Santhosh
Santhosh

Reputation: 751

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.

Upvotes: 1

Christopher Painter
Christopher Painter

Reputation: 55571

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.

Upvotes: 0

Related Questions