nvonada
Posts: 4
Joined: Tue May 14, 2024 10:00 pm

"Remember" AI_INSTALLPERUSER?

One of our products has an install set up as mixed, so it will default to per-user for non-admin users and all--user for admin users. Lately, I have been getting hammered by issues where a machine ends up with BOTH a per-user and all users install on the same machine with different versions. A typical scenario is an IT person will install the software. Since they are admins it defaults to All Users and gets installed that way. Then a user wants to update to a later version. Since they are NOT admins, they get a per-user install. The machine is left with two installs with two different versions and only one of them will work.

What I would like to do is either force the user to do the same install as the previous install OR at least warn them before continuing. I think I can do that via custom actions by saving AI_INSTALLPERUSER in a file or the registry, then checking against that saved value on the next install. But it seems like a clumsy and roundabout way to go. Is there a simpler solution I am just missing?

Thanks!
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: "Remember" AI_INSTALLPERUSER?

Hello and welcome to our forum,

As you've noticed already, a per-user installation can not upgrade a per-machine one and vice-versa.

For this, we can use the "Uninstall previous version" custom action, however, please note that this will ask the user for the credentials of the admin, which he might not have.

Another possible solution would be using the predefined "Preserve Install Type of the old version" custom action.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nvonada
Posts: 4
Joined: Tue May 14, 2024 10:00 pm

Re: "Remember" AI_INSTALLPERUSER?

Catalin,
Thanks! I missed "Preserve Install Type of the old version". I think that is what I am looking for. I will play with that and see if I can figure it out. The documentation is not clear on how it works or how to use it but I see some other postings on the forums that should help.

Nathan
nvonada
Posts: 4
Joined: Tue May 14, 2024 10:00 pm

Re: "Remember" AI_INSTALLPERUSER?

Well, I did some reading and the custom action will not help since it requires admin rights to work. The entire reason we support per-user installs is so users without admin rights can update the software.
"The package which uses this custom action should require Administrator privileges, otherwise, it may not be able to run. Therefore, your package should use a Per-user only (with administrator rights required) or Per-machine only (fails if user is not administrator) installation type."

I could not get it to work even with admin rights, but I am not going to troubleshoot that if it will not work for ordinary users. I may try UninstallPreviousVersion which will at least avoid the version conflicts. I may try saving and restoring the install type myself. Is there any way to use the upgrade code to get the installation folder for the previous version?
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: "Remember" AI_INSTALLPERUSER?

Hello Nathan,

The main problem here is the fact that if the first version was installed per-machine and the user then tries to upgrade that using a per-user, that doesn't quite work. In both cases, admin rights will be required here for the normal user trying to update a per-machine installation done previously by an admin.
I may try saving and restoring the install type myself. Is there any way to use the upgrade code to get the installation folder for the previous version?
We don't quite need to complicate ourselves here, as the installation path is already written by default in the registries.
Screenshot_241.png
Screenshot_241.png (21.61 KiB) Viewed 14984 times

During an upgrade, however, we have to note that this will be removed together with the previous package, so if we want to read it, we should do so before that happens.

Additionally, this only works if we have used the predefined "Application Folder" from Advanced Installer:
Screenshot_242.png
Screenshot_242.png (5.86 KiB) Viewed 14984 times

since APPDIR is a property that stores the value of that folder.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nvonada
Posts: 4
Joined: Tue May 14, 2024 10:00 pm

Re: "Remember" AI_INSTALLPERUSER?

That makes sense. Thanks for the help and I will give that a try. I don't need to recover from this situation as much as detect it and warn the user.
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: "Remember" AI_INSTALLPERUSER?

You are always welcome! :)

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

Return to “Common Problems”