What is the real difference between:
I read the help but don't really get it:
IsAdminInstallMode
: ReturnsTrue
if Setup is running in administrative install mode or if Uninstall is running with administrative privileges.
IsAdmin
: ReturnsTrue
if Setup/Uninstall is running with administrative privileges.
What is the difference between administrative install / administrative privileges?
I am asking because when building I received this warning:
Warning: Line 118, Column 6: [Hint] Support function "IsAdminLoggedOn" has been renamed. Use "IsAdmin" instead or consider using "IsAdminInstallMode".
Which should I use and why?
As the documentation says, the IsAdminInstallMode
returns True if Setup is running in administrative install mode. Where the administrative install mode means:
- The
{group}
folder is created in the All Users profile.- The "auto" form of the directory and Shell Folder constants is mapped to the "common" form.
- The HKA, uninstall info, and font install root keys will be HKEY_LOCAL_MACHINE.
Whether administrator install mode is used depends on the PrivilegesRequired
directive (and in recent versions also by PrivilegesRequiredOverridesAllowed
). You basically use these directives to declare, if the installer needs (or can make use of) the Administrator privileges.
While the IsAdmin
(aka IsAdminLoggedOn
) is true, if the installer has been executed with administrator privileges. So that's something the user controls, not the installer.
IsAdminLoggedOn | IsAdminInstallMode | Meaning |
---|---|---|
True | True | The installer was executed with administrator privileges, and uses them to install the application for all users. |
True | False | The installer was executed with administrator privileges, but does not need them and will still install the application for the current user only. |
False | False | The installer was not executed with administrator privileges, and does not need them as it will install the application for the current user only. |
False | True | Not possible. |
The IsAdmin
is an equivalent of IsAdminLoggedOn
. But usually, you actually want IsAdminInstallMode
, not IsAdminLoggedOn
. That's why the function was renamed and split into these two. It depends on what you test for.