DiegoCP
Posts: 139
Joined: Fri Jan 23, 2015 1:02 pm

Elevated Status handling

Tue Jul 24, 2018 11:34 am

Hello,

i have a question regarding elevating the installation.

i am currently using Installation Type: Per-machine only (fails if user is not administrator)

i have a dialog where the user selects installation path

and if he chooses ProgramFiles(x86) or (ProgramFiles) then i want to elevate installation (get permissions if user is not admin, this is done automatically right now by advanced installer)

and if he chooses a custom folder for example D:/MyApp, i don't want him to get user permissions he shouldnt need.

is this possible?


Thank You for your help!

Best Regards,
Diego.

Catalin
Posts: 6544
Joined: Wed Jun 13, 2018 7:49 am

Re: Elevated Status handling

Tue Jul 24, 2018 2:32 pm

Hello Diego,

What you want to achieve is possible, but not with Installation type being "Per machine only (fails if user is not administrator)". As the name suggests, the setup will fail if the user is not administrator, so it will always require administrator rights to run.

However, what you want is achievable by using the "Per-machine if user is administrator, per-user otherwise" installation type. Also, don't forget to add the "InstallTypeDlg". In order to do this, you can go to "Dialogs" page, select "PrepareDlg" and press the "Add Dialog" button from the toolbar. When prompted with "Add Dialog" window, click on the "InstallTypeDlg" and press "Ok".

Also, due to a Windows Installer limitation, you can get rid of the "Elevation Shield" only when using the "Enhanced User Interface" option from "Themes" page --> under "Settings" tab. Otherwise, it will still be present on the "Install" button, even if your install will not ask for administrator rights if you will not install in locations that require it.

This way, if a user will choose a location for the installation which will require admin rights, the "Elevation Shield" will be set as "True" on the "Install" button. Otherwise, the "Elevation Shield" will be set as "False" on the "Install" button.

Hope this helps!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

DiegoCP
Posts: 139
Joined: Fri Jan 23, 2015 1:02 pm

Re: Elevated Status handling

Tue Jul 24, 2018 3:04 pm

Hello Catalin,

and thank you for quick reply!

I need to do this without using InstallTypeDlg is this possible?

I don't want to add extra complexity to my installer.

Thank you for your help!

Best Regards,
Diego.

Catalin
Posts: 6544
Joined: Wed Jun 13, 2018 7:49 am

Re: Elevated Status handling

Tue Jul 24, 2018 3:21 pm

Hello Diego,

I am afraid that it is not possible to achieve that without using the "InstallTypeDlg", as stated in the "How do I make the package install per-user or per-machine?" article.

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”