Auto-update doesn't try to escalate to admin - Advanced Installer Community
sjstreeting
Posts: 26
Joined: Fri May 03, 2013 11:00 am

Auto-update doesn't try to escalate to admin

This is related to a previous question: http://www.advancedinstaller.com/forums ... =2&t=25907

If a user escalates to Admin during the install, they subsequently cannot update because the Check For Updates program just fails with an Access Denied message. Long term I intend to offer the option to install per-user following the result of the previous question, but surely if the installer escalated to Admin to install, then so should the Auto-update program?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Auto-update doesn't try to escalate to admin

Hello,

I'm afraid I don't fully understand what you mean. Can you please give us more details about this (maybe exmplify)?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sjstreeting
Posts: 26
Joined: Fri May 03, 2013 11:00 am

Re: Auto-update doesn't try to escalate to admin

I've had this scenario reported from one of our users:
  • A non-admin user runs the installer on Windows 7.
  • Our installer is set to 'Per-machine if user is Admin, per-user otherwise', but on Windows 7 that means the user gets a UAC prompt to grant admin permissions and the app is installed as Admin
  • The user runs Check For Updates and there's an update available
  • When they try to apply the update, it fails with Access Denied, because the user doesn't have Admin permissions
So my point is that I was expecting the updater to prompt for Admin permissions the same way as the installer did. Otherwise the user can install the product but never update it without logging out and logging in explicitly as Admin.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Auto-update doesn't try to escalate to admin

Hello,

Please keep in mind this is the normal behavior. When the updater checks for updates it tries to save the updates in the [AppDataFolder][Manufacturer]\[ProductName]\updates\ location (this is the default location - a per user location) set in "Downloads updates in this folder" field from "Updater" page. But, at install time the "AppDataFolder" it is resolved to Application Data folder path of the installing user (an admin user in your case), which will not be accessible for the current non-admin user.

So, in order to avoid this issue you can use a per-machine location in the "Downloads updates in this folder" field. You can use a location like this:

Code: Select all

[CommonAppDataFolder][Manufacturer]\[ProductName]\updates\
Also, you can take a look on our "Call Updater in non admin user" thread which debates a similar issue.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sjstreeting
Posts: 26
Joined: Fri May 03, 2013 11:00 am

Re: Auto-update doesn't try to escalate to admin

Thanks for the info. So the Auto-updater is already escalating to Admin and it's just the resolution of the file location that's wrong?

Can non-admin users always download to [CommonAppDataFolder][Manufacturer]\[ProductName]\updates\? If not, if I alter the installer later (as I intend to do) to offer the option to install per-user instead of per-machine, how do I handle the update download location for the 2 different types of install?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Auto-update doesn't try to escalate to admin

Hello,
Thanks for the info. So the Auto-updater is already escalating to Admin and it's just the resolution of the file location that's wrong?
No, the updater run under the current user. The problem is that it tries to save the update installation package in the [AppDataFolder] location (which points to the Application Data folder of the user which has installed the current version of the product) and this location is not accesible for the current user.
Can non-admin users always download to [CommonAppDataFolder][Manufacturer]\[ProductName]\updates\?
Yes, there should be no problem.
If not, if I alter the installer later (as I intend to do) to offer the option to install per-user instead of per-machine, how do I handle the update download location for the 2 different types of install?
Please keep in mind that a per-user installation cannot upgrade a per-machine installation and a per-machine installation cannot upgrade a per-user installation.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sjstreeting
Posts: 26
Joined: Fri May 03, 2013 11:00 am

Re: Auto-update doesn't try to escalate to admin

I'm still struggling with this. Regardless of what I do, I always get 'Access Denied' as soon as the updater is run in a non-admin user. It doesn't seem to matter where the download location is set to, it doesn't even start downloading.

Surely if I run the updater as a non-admin user, it can download the update to "[AppDataFolder][Manufacturer]\[ProductName]\updates\", and then just run this installer (I only ever distribute major updates), which will then escalate itself? Your previous advice revolved around the download location not being visible to different users, but I don't think that's it. The 'Access Denied' appears immediately when you run the updater, before it even tries to download, and because the update is just a single installer EXE which can be run from the non-admin user and then escalate itself (which works fine on first install), I see no reason why this wouldn't work. There is no case where users are trying to access data in other users folders (FWIW CommonAppDataFolder isn't writeable by non-admin users, so I can't use that anyway).

What is the updater trying to do which is causing the Access Denied error? I don't have any custom steps or anything, it's just the standard updater just trying to download a new self-contained version.
[edit]Could it be the 'Installed Detection' section? I have that set to the standard registry value check, but does that mean the updater wants to write to the registry which might fail?
sjstreeting
Posts: 26
Joined: Fri May 03, 2013 11:00 am

Re: Auto-update doesn't try to escalate to admin

Actually I just discovered that if you install the app as a non-admin user and escalate it to install, the Check For Updates works absolutely fine. You only get the 'Access Denied' if you installed the app as an admin user then try to check for updates from a non-admin user. I'm not sure why but I assume it's that the download folder has actually been set to the other user's directory, it's not resolved when you start the updater?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Auto-update doesn't try to escalate to admin

Hello,

I'm not sure why this happens. When you are using a "CommonAppDataFolder" download location you should not encounter this behavior. Can you please send us all of your .AIPs (of your upgrade, upgraded and updates configuration project) to support at advancedinstaller dot com so we can try to investigate this?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sjstreeting
Posts: 26
Joined: Fri May 03, 2013 11:00 am

Re: Auto-update doesn't try to escalate to admin

I'm not using CommonAppDataFolder, I'm still using AppDataFolder because I've had conflicting advice about the ability of non-admin users to write to CommonAppDataFolder. Other sites said that it wasn't writeable by non-admins, and I've checked the security on my machines here (Windows 7 and 8) and CommonAppDataFolder maps to c:\ProgramData which is only writeable by administrators. The 'Users' group only has read-only permission.

That's why I've kept the setup as it is with AppDataFolder, because right now if the initial install was by the non-admin but they used UAC to escalate, updating works. It's only if the admin installed it when logged in that it goes wrong for a non-admin user, it appears because the AppDataFolder of that admin is used. It seems to me you could fix this by making the download location resolve at the time the updater runs rather than it being set when the initial install was done?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Auto-update doesn't try to escalate to admin

Hello,
I'm not using CommonAppDataFolder, I'm still using AppDataFolder because I've had conflicting advice about the ability of non-admin users to write to CommonAppDataFolder. Other sites said that it wasn't writeable by non-admins, and I've checked the security on my machines here (Windows 7 and 8) and CommonAppDataFolder maps to c:\ProgramData which is only writeable by administrators. The 'Users' group only has read-only permission.
I've tested the scenario using the CommonAppDataFolder and I was able to install the updates using a limited account. So, can you please use the CommonAppDataFolder location in your updater download location and see if the behavior still persist?
That's why I've kept the setup as it is with AppDataFolder, because right now if the initial install was by the non-admin but they used UAC to escalate, updating works. It's only if the admin installed it when logged in that it goes wrong for a non-admin user, it appears because the AppDataFolder of that admin is used. It seems to me you could fix this by making the download location resolve at the time the updater runs rather than it being set when the initial install was done?
I'll add your suggestion on our TODO list and maybe we'll be available in a future version of Advanced Installer. Thank you for your suggestion.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sjstreeting
Posts: 26
Joined: Fri May 03, 2013 11:00 am

Re: Auto-update doesn't try to escalate to admin

Where does CommonAppDataFolder map to for you? Because for me it's c:\ProgramData which is admin-writeable only.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Auto-update doesn't try to escalate to admin

Hello,

Yes, it is resolved to "C:\ProgramData". In order to check if a limited user has write permissions under "ProgramData" folder you can log in as a non-admin user and try to create and write content in a dummy txt file. I've tested this on Windows 7 64-bit machine.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sjstreeting
Posts: 26
Joined: Fri May 03, 2013 11:00 am

Re: Auto-update doesn't try to escalate to admin

OK, I apologize for doubting you - it works, even though the top-level permissions set on the folder say that it shouldn't (read-only for users). The reason is that underneath that in the Advanced options there are a second set of <Special> permissions set for Users which allows each user to create new files, but not write each other's files.

Return to “Common Problems”