Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 2

Add Registry Keys Only If User Has Administrator Rights, Otherwise Don't

Is there a way to put a condition into the installer so that if the person running the installer does NOT have Admin rights then skip a step? I want to skip making additions to the registry if the user is not logged in as Administrator.

Thank you.
Labels (1)
0 Kudos
(1) Reply
Level 12

Typically, an installer is run with administrator privileges in order to make most changes on system, e.g., in "Programs Files" and "Windows" folder, as well as "HKEY_LOCAL_MACHINE" registry hive, etc.

Registry changes in Registry table are gated by component. So, you can control installation of specific registry entry by specifying a condition on the component. You can use Privileged property and/or AdminUser property.

Alternatively, you can use a custom action to create registry entry. However, I would not recommend this route, since for every custom action created, there should be a corresponding rollback custom action, a custom action for uninstallation and its corresponding rollback custom action. In this case, using custom actions is a lot of work for a registry entry when there exists a simpler approach.
0 Kudos