Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 979
Marek Avatar asked May 06 '10 07:05

Marek


People also ask

How do I install a program that requires administrator permission?

If a program requires Administrator privileges to perform certain functions, you need to run the program as Administrator. To run a program as Administrator in Windows 10, right-click the icon in your Start menu and select Run as administrator.

Can you install programs outside of Program Files?

It should be fine by default, but if you want, you can verify the permissions are the same between WinApps and Program Files and if necessary make changes. Keep in mind there can be reduced security or functionality if permissions are changed incorrectly.

Can a non admin install software?

If your laptop is controlled by an administrator, you will find it very hard to install software, because non-administrative standard users may be unable to install any new or modify any existing software.


2 Answers

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.

like image 72
Michael Urman Avatar answered Feb 12 '23 04:02

Michael Urman


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.

like image 34
ChrisF Avatar answered Feb 12 '23 06:02

ChrisF