"Run only if user has admin privs" prereq triggered on Win7 - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

"Run only if user has admin privs" prereq triggered on Win7

Guten Tag,

I am using AI 7.6 build 27499

I have a project which will require admin privileges to install. In order to enforce that, I have selected the "Run only if user has administrator privileges" checkbox on the "System Launch Conditions" tab. On the "Prerequisites" page, I added a Global Prerequisite (Windows Installer 2.0) and I selected the "Check predefined launch conditions before searching for prerequisites" checkbox.

When I run my bootstrapper on a WinXP machine:
* non-admin user sees appropriate pop-up which says "[ProductName] requires administrative privileges to install"
* admin user is able to install

When I run my bootstrapper on a Win7 machine:
* admin user sees the "[ProductName] requires administrative privileges to install" pop-up and cannot install

If I delete my Global Prerequisite and rebuild my project, then the admin user on Win7 does not see the pop-up and can successfully install, as expected. So, it seems like there is some disagreement between having Global Prereqs and the "Run only if user has admin privs" Launch Condition.

The documentation for the predefined launch conditions says:
[The "Run only if user has administrator privileges" option is not supported by Windows Vista or above because of the way the User Account Control works.]
So on a Win7 machine, the bootstrapper should not be triggering this prerequisite.

In another forum I posted concerning the "active Internet connection" prereq, you guys confirmed there was a bug with the interaction between Global Prerequisites and Predefined Launch Conditions. I'm not sure if this is directly related, but it seems to be.

As always, thanks for your help.
-Todd
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: "Run only if user has admin privs" prereq triggered on Win7

Hello Todd,

In Windows Vista and above, the "Run only if user has administrator privileges" launch condition verifies whether or not the package is elevated at the moment this is tested for. This means the user might be an administrator but the package did not yet elevate, meaning the launch condition will fail.

We will modify the note in our documentation to reflect this, sorry for the confusion.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

Re: "Run only if user has admin privs" prereq triggered on Win7

Thanks for your reply, Gabriel.

If I understood you correctly, there is a "race-condition" between the prerequisite check and the UAC elevation. If the UAC kicks-in and elevates the package before the prerequisite check is made, then my user (who is part of the admin group) will be able to install. Otherwise, if the prerequisite check is executed before the UAC can kick-in, the user will see the pop-up message stating that he/she must be part of the admin group.

My bootstrapper is configured with an Execution Level of "As Invoker". Under this configuration, the bootstrapper will always run with non-elevated privileges and so the "Run only if user has admin privs" check will always fail, since the prereqs are evaluated before anything else.

If I change the Execution Level to "Require Administrator", then the UAC kicks-in immediately (before the prereqs are evaluated) and the "Run only if user has admin privs" condition is fulfilled. Looks like I'll need to use that higher Execution Level in conjunction with the "Run only if user has admin privs" option. Are my assumptions correct?

Gratzi,
-Todd
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: "Run only if user has admin privs" prereq triggered on Win7

Hi Todd,

Indeed your assumption is correct.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”