How to run a Custom Action inside an MSI created in WiX with elevated privileges

custom-actioninstallationwindows-installerwix

I have an installer that needs to access the registry and copy and remove files using custom actions.
In Windows XP the installer works just fine, but in Vista and 7, the installer shows an error because it cannot access a folder, but if I run the installer as administrator everything works.

So, I need the installer to be able to run the custom action as administrator even if the MSI wasnt run this way (need the installer to be run by regular users). I tried using an EXE at the beginning of my installation to modify the registry and allow the MSI to run normally but I dont think that's a very good solution.

PS. Bootstrapper is not an option due to client requirements :S
All my custom Actions are deferred and impersonate="no"

Any ideas?
Thank you

Best Answer

Make sure that:

  • it's scheduled after InstallInitialize
  • "Execute" attribute is set to deferred
  • "Impersonate" attribute is set to no

Please note that deferred custom actions cannot access the installation session, so you cannot access installer properties directly.

Related Topic