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!

shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Doubt in "Run as Administrator"

Hi,

I have a "per machine setup(fail is user is not administrator)" along with the "Run as administrator" option checked.

When I install this with a user who does not have administrative rights(say guest), setup prompts for the "Administrator user name and password"(say admin)
- I could see that setup runs in the context of "admin"
- In setup, at the end, I launch an application(say DesktopControl.exe). Setup launches the "DesktopControl.exe" in the context of the "admin"
Is it possible to launch the DesktopControl.exe in the context of loggedin user(i.e guest)??

Regards,
Rohan
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Doubt in "Run as Administrator"

Hi Rohan,

When the Run as admin option is enabled in the Install Parameters page the installed application will be launched with elevated right at the end of the installation process, so you cannot launch it in context of the log on user (e.g. guest).

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Re: Doubt in "Run as Administrator"

Is there a way to "not to display the Elevation Prompt dialog, instead just show a message and terminate the setup in case a non-admin launches the setup"?
Or are you saying "there is no way"??

In the setup, is there a way to know that "user is elevated", so that we could write some code so that our application not launched?

Regards,
Rohan
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Doubt in "Run as Administrator"

Hi Rohan,
Is there a way to "not to display the Elevation Prompt dialog, instead just show a message and terminate the setup in case a non-admin launches the setup"?
You cannot prevent the UAC dialog from appearing when you perform a per-machine installation. Only if you install a package per-user you can skip showing this dialog.
If you set the option "Run as administrator" you will inform UAC to show the dialog the moment you execute the installer.

If the UAC is off then it will not be any prompt to enter admin credentials.
If the UAC is off then the installation will be launched with the current log-on user right. If the log on user is a guest and the installer require administrator privileges then the installation will fail because it doesn't have sufficient privileges to complete this installation for all users of the machine.

You can take a look on the User Account Control article which may be useful to you.
In the setup, is there a way to know that "user is elevated", so that we could write some code so that our application not launched?
You can check programmatically to see if the current user is part of admin group.
For this, you can take a look on the How to tell if the current user is in administrators group programmatically thread which may be useful.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Re: Doubt in "Run as Administrator"

Thanks for the information Dan.

From your explanation, I understand the following
- Since we are supporting per-machine installation, Advanced Installer can not hide the "UAC dialog".
- We can change the Setup, so that it could check whether "Admin" has invoked the Setup, if not(admin), then we could terminate the setup. But this may not work in all operating systems.

Code: Select all

because the link says "The example will not work in Windows Vista. In Windows Vista, even if the user is in administrators group, the OS will create a filtered user token when user log on"
Please correct me if I am wrong.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Doubt in "Run as Administrator"

Hi Rohan,
- Since we are supporting per-machine installation, Advanced Installer can not hide the "UAC dialog".
Please keep in mind that any tasks that require administrator privileges will trigger an UAC prompt (if UAC is enabled) and the user will have to enter its credentials.
The UAC prompt is controlled by the Operating System and not by Advanced Installer.
- We can change the Setup, so that it could check whether "Admin" has invoked the Setup, if not(admin), then we could terminate the setup. But this may not work in all operating systems.

Code: Select all

because the link says "The example will not work in Windows Vista. In Windows Vista, even if the user is in administrators group, the OS will create a filtered user token when user log on"
I've read that too. It seems that you need to search another way for Windows Vista to see if the current log on user is part of an administrator group. The above link can be used as a starting point for your investigations.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Re: Doubt in "Run as Administrator"

Thanks for the update
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Doubt in "Run as Administrator"

You're always welcome Rohan,

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”