[wix-users] Custom action with optional elevation

Rob Mensching rob at firegiant.com
Fri Aug 5 09:12:53 PDT 2016

I believe you declared that your MSI will not elevate. Windows Installer should respect that and not elevate.

 Short replies here. Complete answers over there: http://www.firegiant.com/

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Frédéric Bruneteau
Sent: Friday, August 5, 2016 7:20 AM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Custom action with optional elevation


I have an installer launched as user (not Admin):

    <?define InstallScope="perUser" ?>
    <?define InstallPrivileges="limited" ?>

I implemented a custom action that could require elevation (Administrative Privileges) to update a file of the system.
The installer should ask Admin privileges only if it's necessary.

As described in CustomAction documentation (http://wixtoolset.org/documentation/manual/v3/xsd/wix/customaction.html)
the custom action uses attributes "Execute='deferred'" and "Impersonate='no’" :

  <CustomAction Id='UpdateSystemFile' BinaryKey='CustomAction' DllEntry='UpdateSystemFile' Execute='deferred' Impersonate='no' Return='check'/>

In the use case that requires elevation, I don't see any dialog box indicating the machine can change or asking Admin credentials, and the custom action does update the system file.

Is there a specific API to ask elevation in a custom action ?
Could MSI change dynamically (at runtime) its privileges from user (limited) to admin (elevated)  ?

Best Regards,
Frédéric Bruneteau

More information about the wix-users mailing list