How to see if the logon user has admin rights? - Advanced Installer Community
Codename K
Posts: 479
Joined: Fri Jan 29, 2010 3:04 pm

How to see if the logon user has admin rights?

Hello,

I am running an installer with UAC settings off. However I have to make the installer set a Schedule Task. Only for this part I get the access denied message to create the task. The installer must have the UAC settings off. So, how can I make the installer detect whether the current user has admin rights and if not show a new custom dialog (which will tell the user to run the installer as admin again). Furthermore, if the user do not have the admin rights then install without the task creation.

To make it simple, the user runs the installer without the admin rights. When he clicks the install button another dialog will be shown telling the user there is no admin rights to create the Schedule Task. At this point the user can still continue installing from the custom dialog without admin rights. If this is the case then the installer will not create the Schedule Task.

:)
K
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to see if the logon user has admin rights?

Hello,

Please note that the AdminUser property is 1 when the LogonUser has administrator privileges and this property is empty otherwise. Please keep in mind that this scenario is working as expected only if the UAC is off.

You can add this property in the in the Condition field of the Schedule Task Properties. So, this task will be created only if the logon user has administrative privileges.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Codename K
Posts: 479
Joined: Fri Jan 29, 2010 3:04 pm

Re: How to see if the logon user has admin rights?

Hello,

Thanks for your help. It worked. I did look at this link earlier,

http://www.advancedinstaller.com/user-g ... props.html

However, in the page it is written that "AdminUser: Set on Windows 2000 if the user has Administrator privileges.", so I assumed this may be only on Windows 2000 and not above.

Thanks

:D
K
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to see if the logon user has admin rights?

Hello,

In order to this property be set here are the minimum requirements:
  • -Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7.
    -Windows Installer 4.0 or Windows Installer 4.5 on Windows Vista or Windows Server 2008.
    -Windows Installer on Windows Server 2003 or Windows XP.
You can take a look on the AdminUser property documentation where you can find out more information about.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Codename K
Posts: 479
Joined: Fri Jan 29, 2010 3:04 pm

Re: How to see if the logon user has admin rights?

Hello,

Thanks for your support so far. However, I have another issue. The installer is set as Per User Only Installation Type. This only affects the schedule task created from the Updater page which needs to be Run As Admin. When we run the installer like this it does not create the shortcuts. This works when the installer is run normally. But, shortcuts are not created when we right-click and Run As Admin. Installer in run on Stander User account.

One more thing, this problem is only in Windows 8. On previous versions of Windows (where it is Per User Only Installation Type as usual), the schedule task is created fine.

:)
K

Return to “Common Problems”