This question already has an answer here:
- Specify the registry uninstall key location/hive via [Code] 2 answers
- Make Inno Setup installer request privileges elevation only when needed 2 answers
I'm using Inno Setup to deploy an application.
For most cases, a per-user installation that doesn't require admin privileges is fine. However, there are scenarios where I need to install the app for all users, e.g. for Citrix or TSE.
Unfortunately it doesn't seem possible to choose dynamically between per-user and per-machine install. It depends on the PrivilegesRequired
setting, which is set at compile time.
My latest workaround attempt almost got me there. Basically I have a setup with PrivilegesRequired
set to lowest
, and if I need to install for all users, I restart the setup with admin privileges. This works, BUT the uninstall information is still written to HKEY_CURRENT_USER
rather than HKEY_LOCAL_MACHINE
.
My questions:
- is there a way to achieve dual per-user/per-machine install with Inno Setup? (without generating two different installers)
- if not, is there a way to write uninstall info to HKEY_LOCAL_MACHINE
when PrivilegesRequired
is set to lowest
?
EDIT: the accepted answer to this question doesn't apply in my case. I want to request UAC elevation only when a specific argument (/AllUsers
) is passed on the command line. Without this argument, the UAC prompt shouldn't appear even if the user is an admin. And TLama's answer has the same problem as my current approach.