1
votes

I have a Wix installer with a "Test connection" button.

I am using a custom action to do my connection test.

But this custom action need administrator privileges, so I get an error.

The only way I found to make it work is to run the MSI as administrator using the command line or using "right click, run as different user".

Otherwise, the administrator privileges are only asked before the installation when clicking on "Instal".

Is there a way to prompt for admin privileges directly when running the installer ?

EDIT : I found this solution but I can't use "Execute="deferred" Impersonate="no"" because I need to execute the action directly

2
Hello, how exactly did you solve the problem? In link to solution, he uses impersonate="no", but right after that you say I cant use impersonate="no". Thanks.Tomáš Filip

2 Answers

1
votes

Use a bootstrapper. Create a EXE-file which requires administrator priviliges via a Manifest.xml and launch msiexec with the path to your msi-file.

msiexec /i Example.msi

According to the used API to launch msiexec you may have to ensure that the priviliges of the bootstrapper are passed to msiexec.

There may be solutions available which do exactly this (like Burn).

1
votes

You could arrange to shellexecute an external program with an elevation manifest, but this is not usually helpful because you haven't installed anything yet, so it has to be a separate executable on the install media. Also it needs to return success via its exitcode to your button.

I've never found these things useful, although they persist in popularity. If it's a configuration step then it frequently works better as a config program that runs after the install or at first boot of the app. If it doesn't connect, the install environment is not the best place to try to debug why it may not be working.