prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Non-admin installation

Tue May 29, 2018 4:33 pm

Hello,

I have an installer in which I want to allow the user to install the product even if he's not an administrator. The main motive is to set the registry to HKLM is the user is admin or else to HKCU if he's not an admin. So for this, I did the following things:
  • Disabled "Run as administrator"
    Set the install type to: Per-machine if user is administrator, per-user otherwise
    Added "InstallTypeDlg" in the dialogs
Everything works fine, however in the "VerifyReadyDlg" when I click on "Install" it still asks for admin permissions. So, is there a to allow the user to install the product without admin permission?
I have attached the .aip file which reproduces the above mentioned behaviour.

Thank you.
Attachments
AdminTest.aip
(17.58KiB)Downloaded 445 times

Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Non-admin installation

Thu May 31, 2018 1:26 pm

Hi,

Your problem appears because you set the package type to "Mixed 32/64-bit matching the platform" which is not compatible with the "Per-machine if user is administrator, per-user otherwise" option.

Please read the "Per-machine and per-user installations on Windows 7" which debates a similar problem.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Non-admin installation

Wed Jun 13, 2018 9:37 am

Hi Eusebiu,

I changed the package type to "32-bit package" but still I face the same issue. It asks for the admin permission when I click on the "Install" button in "VerifyReadyDlg", even if I select "Only for me" in the "InstallTypeDlg".

I have attached the .aip file which reproduces the issue.

Prerak
Attachments
AdminTest.aip
(16.95KiB)Downloaded 375 times

Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Non-admin installation

Wed Jun 13, 2018 11:19 am

Hi Prerak,

This happens because the application folder is set to "[ProgramFilesFolder][Manufacturer]\[ProductName]" in the "Product Details" page of your project. Please set it to "[AI_UserProgramFiles][Manufacturer]\[ProductName]" and see if it works.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Non-admin installation

Fri Nov 13, 2020 8:09 pm

Hi Eusebiu,

While the solution you provided worked in the past, I am having the same issue again in one of my other projects.

The only difference between the old and the new one is, there's no "InstallTypeDlg" in the new one.
The reason being, this is used via command line (silent mode), so I don't need any user input. All I want is to install it per machine if launched by an admin or per user if launched by a non-admin user.

If I launch the built EXE via command "[filename].exe /qn", it still asks for admin password.

I have attached the aip file for reference.
Could you please have a look at it and let me know, what am I missing or doing wrong?

Thank you.
Prerak

Note:
There are some elements that will be part of the project but I have deleted them for testing. Those would be:
- One JS execution script
- One "Launch installed file" custom action
- Some registry entries in HK_UM
- One file in "Windows Volume/Temporary" directory.
- One Pre-Install prerequisite which will also be installer silently. (It supports per user installation)

If the per user installation can be an issue for any of these, please do let me know that as well.
Attachments
ZeePrintClientICAAreas.aip
(32.47KiB)Downloaded 272 times

Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Non-admin installation

Thu Nov 19, 2020 2:56 pm

Hi Prerak,

I'm afraid that silently installing a "per-user/per-machine" package and having it installed based on the user permission is not that simple. When the package is installed with Full UI, a dedicated custom action is executed based on the user selection from the "InstallTypeDlg" dialog, but that custom action is not executed on a silent installation.

So, in order to silently install the package per-user, you need to send the "MSIINSTALLPERUSER=1" property from the command line and also set the "APPDIR" property to a per-user location as in the example below:

Code: Select all

[filename].exe /qn MSIINSTALLPERUSER=1 APPDIR="C:\Users\<username>\AppData\Roaming\Your Company\Your Application"
Let me know if this helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Non-admin installation

Thu Nov 19, 2020 4:11 pm

Hi Eusebiu,

Thank you for your response.

Yes, I ended up doing exactly what you suggested. I added the following in the MSI command line in Builds settings:

Code: Select all

/qn AI_INSTALLPERUSER="1" MSIINSTALLPERUSER="1"
So, now when the user launches the EXE, it gets installed per user silently. The APPDIR is determined automatically.
For the moment, as a workaround, I build two different packages, one for admin and one for non-admin user.

One of the other things that I tried during testing was setting AI_INSTALLPERUSER and MSIINSTALLPERUSER ("1" or "2") via an inline PoserShell script that was executed after the "Searches" action in "Install Execution Stage". The value of the properties were set based on the value of Privileged property.
However, that did not work out. May be I am missing something in this approach?


Prerak

Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Non-admin installation

Fri Nov 20, 2020 1:09 pm

Hi Prerak,

I'm afraid that the "MSIINSTALLPERUSER" property must be set before the install sequence. This can only be set during the dialogs stage or from the command line. Since the installation is performed silently, you need to set it through the command line.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Non-admin installation

Fri Nov 20, 2020 1:22 pm

Hi Eusebiu,

Got it. Thank you for the information... :)

Prerak

Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Non-admin installation

Mon Nov 23, 2020 12:57 pm

You're welcome Prerak. Glad to help.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”