How to ensure the setup program will run with administrator rights?

Craig Johnston picture Craig Johnston · Oct 27, 2010 · Viewed 8.5k times · Source

If I create setup package using Inno Setup, will the setup program have administrator privileges allowing it to register DLLs etc. ?

Also, if the setup package executes a program as part of its operations, will that program be run with the administrator rights ?

Answer

splash picture splash · Oct 27, 2010

This is controlled via the PrivilegesRequired directive.

When set to admin (the default) or poweruser, Setup will always run with administrative privileges. If Setup was started by an unprivileged user, Windows will ask for the password to an account that has administrative privileges, and Setup will then run under that account.

If the setup executes a program from the [Run] section, then you can control the privileges of the spawned process with the runascurrentuser and runasoriginaluser flags.