How to choose install context based on UAC prompt selection

Got a problem you cannot solve? Try here.
hdwivedi23
Posts: 17
Joined: Mon Oct 14, 2013 6:41 pm

How to choose install context based on UAC prompt selection

Postby hdwivedi23 » Thu Nov 12, 2015 3:44 pm

This is what I want to achieve:

1) Always prompt user for UAC (even to limited users)
2) If user accepts UAC, continue with per-machine installation
3) If user cancels UAC, contnue with per-user installation

This is similar to what Firefox installer does. How can I achieve this?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: How to choose install context based on UAC prompt select

Postby FrancescoT » Mon Nov 16, 2015 1:37 pm

Dear Hdwivedi23,

in order to achieve such functionality you should call the installer from another process.

You may try this;

The external process may be a dummy wrapper installer which "only" embeds the real installer. The wrapper may be created from the pre-defined "Blank" project template (a completely blank project with a blank setup script). To embed the real installer with the wrapper, add the "real installer package" to the SUPPORTDIR of the wrapper project (see IA documentation for more details about SUPPORTDIR).
Both the wrapper and the installer should be built using the "Never Elevate (as Invoker)" UAC elevation level.

From the Wrapper you should execute "the real installer" forcing it to run As Administrator and If the user doesn't confirm the ELEVATION, you should execute "the real installer" one again, but this time without elevating it.

You may use the "ShellRunas" utility (https://technet.microsoft.com/en-us/sysinternals/cc300361) to run "the real installer" as ADMIN from the wrapper or you may create a very simple application at such purpose. Of course, even this application has to be included with the wrapper (via SUPPORTDIR ... in order to call it at wrapper runtime).

Also note that by default limited users doesn't have access to restricted system areas as "Program Files" folder (due UAC). To skip this limitation, the package has to be installed under "C:\Users\>USERNAME>\AppData\Local\" and this is the trick used by the Firefox installer when installing under a limited account context. Therefore from "the real installer", you should handle the TARGETDIR path accordingly and this can be easily done via IA setup script.

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

hdwivedi23
Posts: 17
Joined: Mon Oct 14, 2013 6:41 pm

Re: How to choose install context based on UAC prompt select

Postby hdwivedi23 » Tue Nov 17, 2015 10:25 pm

Thanks Francesco.

I use a MSI wrapper. Is it possible to do it with a MSI wrapper?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: How to choose install context based on UAC prompt select

Postby FrancescoT » Wed Nov 18, 2015 12:30 pm

Dear Hdwivedi23,

yes, you may use a MSI based wrapper ... but in this case, it's not necessary at all and even not recommended.

The Wrapper doesn't install anything and due the scope of your request, it's exclusively used to run the "Real Installer".
The Real Installer instead can be a MSI based package of course ... but it's not mandatory.

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


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 88 guests