Conditional Admin/UAC eleavtion

Got a problem you cannot solve? Try here.
Post Reply
tfrey
Posts: 2
Joined: Thu Jun 13, 2013 2:10 pm

Conditional Admin/UAC eleavtion

Post 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
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Conditional Admin/UAC eleavtion

Post 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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
tfrey
Posts: 2
Joined: Thu Jun 13, 2013 2:10 pm

Re: Conditional Admin/UAC eleavtion

Post by tfrey »

Francesco, thank you very much for your detailed response. I'm working on implementing your 2nd suggestion.

Best,

TF
Post Reply