0
votes

I am installing a per-machine .msi with elevated rights which runs a exe before install finalize. this exe changes a lot of different stuff and one of these requires to use the local user profile which I get using environment.specialfolder.userprofile enum. the problem is that my exe and msi needs to run with elevated rights so it is using the admin user profile.

this question is really similar to this one: Run unelevated custom action from a WiX elevated installer

any thoughts on how to solve this without pulling out the non-elevated actions of the exe and creating another custom action?

1

1 Answers

0
votes

I have several thoughts. The first is out of process EXE's are generally a bad idea because you lose the declarative, transactional nature of MSI. MSI can't undo, monitor, repair what it doesn't know about. The administrator can't see or transform what is being done by the EXE.

The second is managing per-user data is a pain. However if you must do it, the best technique is to split the stuff that is per-machine and requires elevation into one custom action and the stuff that is per-user and doesn't require elevation into another. Then use the Active Setup registry key to detect when another user profile has come into scope and run the MSI in repair mode to apply the per user data to the new current user.

I would have to know what this EXE is doing to give you best practice suggestions to improve the overall quality of your installer.