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
FOLLOW US
Get the latest news in Application Packaging