[wix-users] Prompt for Windows Credentials in Wix for Admin Privileges

Edwin Castro egcastr at gmail.com
Fri Nov 24 12:19:25 PST 2017

If he already has InstallPrivileges="elevated", then he doesn't need the
condition. The Windows Installer will attempt to elevate at the right time
and ask for admin credentials if the user is not admin already. This is all
handled by the Windows Installer itself and not by WiX.

If he is not seeing this behavior, then he is doing something wrong OR has
encountered as corner case that breaks the normal rules. We do not have
more information so we're left making guesses.

One such guess, based on experience, is that perhaps he is running an
immediate mode custom action requiring elevation. Immediate custom actions
are not supposed to change system state so they do not run elevated
regardless of whether the user is admin or not. The resolution to this
depends on what he is trying to do. If he's trying to change system state,
then changing the custom action to deferred is the correct action. But
perhaps he is not changing system state and is querying the system for
information using a tool that requires elevation (this is that one corner
case I mentioned) so he can't run the custom action as deferred since that
would be too late. Unfortunately, we are not psychic so we can't provide
targeted support without more information.

The recommendation is to remove the condition, keep
InstallPrivileges="elevated", and observe the install (get a verbose
install log) to determine what actually fails and then come back to the
mailing list with a question about why the thing that actually fails is
failing. Only then can we provide helpful support.

Blindly attempting to implement customer requirements without understanding
the technology nor why the requirement is actually needed will only lead to
a really fragile installer that will anger users. Some customer
"requirements" are not required but actually come about because the
customer doesn't know any better.

I keep talking about the Windows Installer as different from WiX because
they are not the same. We would never blame Visual Studio or the Visual C++
compiler for behavior in the Windows operating system. WiX is like Visual
Studio. The Windows Installer is like the Windows operating system. Before
learning WiX you really need to learn the Windows Installer.

Edwin G. Castro

On Nov 24, 2017 11:37 AM, "Habib Salim via wix-users" <
wix-users at lists.wixtoolset.org> wrote:

This forum/mailing list has been a great help to me.  There are so many
knowledgeable people who help so freely.

I have been following this thread with some interest.  Although I don't
have a solution to the problem itself (I am barely able to get by and am
no expert)
I've been in similar situations before - struggling for an answer, may not
be asking the question the right way, and not know how or what to ask.
I'll try to ask the question differently on Ven's behalf.  To me, he is
doing the best he can, and perhaps we can help by asking a few questions

Ven wants any user to be able to install the application by executing the
He sets InstallPrivileges="elevated", expecting that if the user does not
have admin rights, the package would prompt for admin credentials.
It does not appear that he wants to capture/validate/store this - he just
wants the installer to install with elevated privileges.

Kaveesh  Davora replied that MSI auto-elevates and it is not necessary to
check for this.  Does that mean setting Install Privileges is not
necessary, as Joe Casale says?
Does that mean that setting InstallPrivileges should not be set?

Walter, Ven wants the installer to prompt for escalation.  What does he
need to do to get the installer to display the admin login prompt?

The batch file is Ven's attempt to find a workaround.

Ven, Do you have any custom actions in your installer that need elevated
privileges?   You probably found this already.  does it help?

Happy Shopping to all.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
Of Edwin Castro via wix-users
Sent: Friday, November 24, 2017 1:35 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Edwin Castro <egcastr at gmail.com>
Subject: Re: [wix-users] Prompt for Windows Credentials in Wix for Admin

All standard actions will do The Right Thing (R). If you're not getting
prompted then you're doing something else wrong, like running custom
actions requiring elevation in immediate mode.

You should consider asking why something works or doesn't work the way you
expect instead of asking how to implement a specific solution to a problem
you have not fully described. This is especially true when experts are
telling you that you're trying to do something bad, not recommended, or
not a best practice.

When asking why, you must explain what you are doing and why as well as
what you expect and why you think you are observing behavior that doesn't
match your expectations. This information is critical for providing the
best advice for your specific scenario.

If you ask about a bad solution, then all you'll get is a lot of responses
not to do it. Remember the customer is not always right, especially when
highly specialized technology is involved. The Windows Installer is *not*
a scripting language.

Edwin G. Castro

On Nov 24, 2017 01:01, "Ven H via wix-users"
<wix-users at lists.wixtoolset.org>

Thanks a lot for your response Nir. What you are referring to is Custom
Action, right? I also have Registry key creation, Adding files to Program
Files location, Custom Services, IIS setting changes (creating sites and
app pools), Database deployment and so on. I am not sure how to handle
these without Admin privileges.


On Fri, Nov 24, 2017 at 1:20 PM, Nir Bar via wix-users <
wix-users at lists.wixtoolset.org> wrote:

> You should author any action that requries admin privileges as
> deferred with Impersonate="no"This will ensure that admin rights are
> granted for these actions without needing the LaunchCondition.
> --Independent WiX Expert. Creator of-
> JetBA: WPF Bootstrapper User Interface Framework
> JetBA++: Native Qt Bootstrapper User Interface Framework
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/

WiX Toolset Users Mailing List provided by FireGiant

WiX Toolset Users Mailing List provided by FireGiant

WiX Toolset Users Mailing List provided by FireGiant

More information about the wix-users mailing list