Page 1 of 1

Appdata files going to admin's appdata instead of standard user

Posted: Mon Sep 24, 2018 2:17 pm
by frank may
Hello,

I have built an installation with the UAC setting of "Always Elevate (require administrator). My installation puts data files in the $MYAPPDATA$ folder. When a standard user that is not a local administrator runs the installation they are prompted to enter an administrator username and password as expected to be able to proceed. Unfortunately the installation puts the files from $MYAPPDATA$ into the adminstrator's appdata folder and not the original standard user's appdata folder. Consequently when the standard user runs the program it fails because it is looking for these data files in their appdata folder and they are not there.

What must be done so that even when the standard user starts the installer and gets an administrator to enter their credentials, the data files can be placed in the standard user's appdata folder?

Thanks

Frank

Re: Appdata files going to admin's appdata instead of standard user

Posted: Fri Nov 09, 2018 1:53 am
by SteveDude
What are you using to populate the $MYAPPDATA$ variable?


Get Folder Location System->Application Data Directory and/or Get Common Folder System->Application Data Directory should return the actual path as long as you don't have Get for all users checked.

Re: Appdata files going to admin's appdata instead of standard user

Posted: Sun Feb 17, 2019 7:53 am
by Paul Guthrie
Hi,

Did this get resolved?

I am experiencing the same issue.

Get Folder Location System->Application Data Directory ( Get for all users is UN-checked)

returns the admin appdata folder and NOT the standard user appdata folder.

I am running X8 (build 7.21.2018).
Just downloaded X9 (build 2.8.2019), the problem exists there also.

More info:
- native build
- windows 10
- UAC elevation = Always Elevate (requireAdministrator)

Paul G

Re: Appdata files going to admin's appdata instead of standard user

Posted: Mon Feb 18, 2019 12:26 am
by frank may
Hi Paul,

I did resolve it. It took me a boatload of time to figure out. Nobody really seemed to understand my problem or have a fix for it. The behavior you are seeing is basically not "wrong" behavior because once the admin password is entered, the user is the admin user. I tried storing the information in the registery or environment variables but it kept failing because of permissions issues. I had this problem in two different situations and this is how I got around them.

Situation 1
1. use Elevate Administrators Only (highest available)
2. put ALL of the install files in the $myappdata$ section so that you should never need to get an administrator password.

Situation 2
1. Create 2 installs. The first one is used to capture the standard user's path and then call the 2nd installer, which is your real installer that prompts for admin access.
2. The first installer writes to a file in the users\public folder (ie userinfo.txt). It should write to the top of the file and write the location of the $myappdata$ folder of the standard user
3. The 2nd installer should read the first line of the file written to in step 2 and use this path to write what it needs to do.


I hope that this helps and saves you days of trial and error.

Frank

Re: Appdata files going to admin's appdata instead of standard user

Posted: Mon Feb 18, 2019 3:44 am
by Paul Guthrie
Hi Frank,

Thanks for that! Your detailed response is very much appreciated.

Paul G