Is it possible to install into Program Files with limited privileges?
Asked Answered
A

3

7

I have an application that will be deployed as MSI package (authored in WiX).

I am deciding whether to specify elevated or limited privileges as required for the installer.

The application does not include anything requiring elevated privileges besides the default install location, which is under Program Files.

Now the problem:

  • If I specify elevated privileges, then the user is prompted by UAC for administrator password during the installation. This is not required and prevents non-admin users from installing.

  • If I specify limited privileges, then the user is presented with a dialog to select install location with Program Files being default. In case they do not change the install location (95 % of end users probably won't), then the installer will fail with a message that they should contact the Administrator or run the application as administrator. If they launch the installer as Administrator then they can install into Program Files without problem - but most of the users won't probably know how to launch an installer as administrator.

I can potentially set the default install location to e.g. C:\Company name\Program\, but this seems nonstandard to me and majority of users will not probably like this (they are probably used to installing into Program Files).

How do you solve this problem with installing applications under limited user accounts?

Accra answered 6/5, 2010 at 7:47 Comment(0)
C
6

The alternate location you propose, directly off of the C Drive, is likely to also require elevated privileges. Before Windows 7, I would suggest using an early custom action to change your default location for limited installations. Condition it off of the Privileged (or possibly AdminUser) property, verify whether you need to set MSIUSEREALADMINDETECTION for your case, and use something like [LocalAppDataFolder]Company\Product. Unfortunately this approach will result in a package that is difficult to install for all users as you must pre-elevate, and in the limited case they could still select a target location that requires elevation. They must pre-elevate because the package must be marked to not elevate.

If you can target solely Windows 7 and later, you can conditionally set MSIINSTALLPERUSER to override the install location and the elevation requirement, and instead install per-user. In this scenario, the user could be asked whether to install for all users (requires elevation) or just for himself. The package can be marked for elevation, and setting MSIINSTALLPERUSER will override that and skip the UAC prompt.

Carolynecarolynn answered 6/5, 2010 at 13:21 Comment(2)
No, the alternate location does not require elevated privileges. I am currently installing by default into C:\Company name\Product and the MSI installer is built with limited privileges and no UAC comes up, nor any error dialog.Accra
That sounds like a custom environment then, but that's fine if you know it'll be in place anywhere your product is installed. The rest of the answer applies; merely ignore the limited privilege location suggestion.Carolynecarolynn
L
3

It's probably more important that your software runs with normal user privileges - which I see you've mentioned isn't an issue.

There's nothing wrong in asking for admin rights to install something.

Either, the user will have the details themselves as they are running a limited account for safety reasons or the software will be installed by their company's IT department anyway.

Leontine answered 10/5, 2010 at 13:46 Comment(0)
B
-2

Run command prompt(cmd) as administrator.

Then use msiexec command to execute msi file.

Brolly answered 7/5, 2010 at 14:2 Comment(2)
I can not ask the end user to do thisAccra
u can ask user to do this...as for installing any s/w one should have admin privileges. So thers nothing wrong in asking him to do so. Or you can aks user to login with admin credentials and then install s/wBrolly

© 2022 - 2024 — McMap. All rights reserved.