PDA

View Full Version : Checking User's rights?



JerryS@cat
03-21-2023, 11:01 AM
As I usually do, I searched the forum for something on this subject and didn't find anything applicable, so I'm posting my question here.

According to the SetupBuilder manual, the user's privilege level can be checked via the %_SB_INSTALLERFLAG% built-in variable using code similar to below:

If %_SB_INSTALLERFLAG% Equals "1" on Position "4" Then
Set Variable %ADMIN_RIGHTS_SWITCH% to "ON"
Else
Set Variable %ADMIN_RIGHTS_SWITCH% to "OFF"
End

According to the excerpt below (from the SetupBuilder manual), the 4th bit of the %_SB_INSTALLERFLAG% should have a value of "1" if the user running the script had administrator privileges. If not, that bit should have a value of "0". I've tried this with both user accounts that do have administrator privileges on the machine and user accounts that have ordinary user rights. In all cases, that bit has a value of "1". Is there something I'm missing here, or is this something that may have changed with later versions of Windows? Ideas?

5119

linder
03-22-2023, 11:25 AM
Hi Jerry,

this if for pre-UAC aware systems only (or if UAC is completely disabled). In modern UAC environments, the installer always has admin rights if it is running elevated (e.g. "requireAdministrator" manifested). Do you have your installer running "asInvoker" (that means: per-user)?

Friedrich

linder
03-22-2023, 11:33 AM
Jerry,

BTW, please use "Get System Information" -> "Installer Elevation Type". This lets you determine whether a User is a Member of the Administrators Group with UAC Enabled.

Does this help?

Friedrich

JerryS@cat
03-22-2023, 02:02 PM
Friedrich:

You've answered my question. Thank you.