Page 1 of 1
Conditional Admin/UAC eleavtion
Posted: Thu Jun 13, 2013 2:20 pm
by tfrey
Hi,
I'm working on a project that installs an application in the users AppData\Local directory, so any user should be able to install without incurring any permission issues.
However, as pre-requisites, we require certain .NET frameworks to be installed and these can only be installed with admin privileges.
Is there any way that the installer only requests admin/UAC elevation after it determined that a .NET framework has to be installed?
Thanks,
TF
Re: Conditional Admin/UAC eleavtion
Posted: Fri Jun 14, 2013 8:30 am
by FrancescoT
Dear User,
it is not possible to elevate a process once already started. It must be restarted in order to have it elevated.
You have two possibilities to achieve this situation;
1# You can use a message box to inform the user that the package has to be elevated in order to complete package installation.
Doing this, you can display this warning only if the runtime installation is required.
2# You could create a separate setup package that only includes the NET Runtime installation and if the runtime package installation it is required, you can execute it from your product package installation. The separate package can be executed via script using "Run Program as" command and even the package itself can be builded with the required UAC level.
I may suggest also, this separate package can be created without including any user interface ( ..or a minimal one if you prefer) and with skipping the default installation behavior, that you usually have with a standard package.
A quick example;
1# create a new project from scratch using the BASIC project template:
2# comment out all the main script code included within the REGIONS; DEFINE SETUP GLOBAL, Setup User Interview, Process (Un)Installation and Finish Setup.
3# add the required NET runtimes to the project
If you build and run the project, you will see that the package will only install the runtimes (If required) and terminates its execution once completed.
Doing in this way, the package is only a container for your runtimes and it is not listed under ADD REMOVE PROGRAM ( ... due the fact that Apply Install is never called).
Hope this helps you.
Regards
Re: Conditional Admin/UAC eleavtion
Posted: Fri Jun 14, 2013 1:03 pm
by tfrey
Francesco, thank you very much for your detailed response. I'm working on implementing your 2nd suggestion.
Best,
TF