FGump
Posts: 65
Joined: Thu Jan 05, 2006 7:23 pm

UAC and Permissions

This may be a dumb question, but I've never encountered this issue before until yesterday. I updated my AI package and installed my application on several workstations (all running Windows 7 x64). The installation installed without any errors. But when I look at the folder where my application got installed, C:\Program Files (x86)\MyApp, I noticed that a folder I told the install to create (called Logs) is not present. No matter, when my application runs, it looks for this folder and creates it if it doesn't exist so it can write it's log files. Oddly enough my app runs great, but the Log file never gets created - nor the log file.

I finally ended up seeing that the user doesn't seem to have the needed privilege to write to this folder and as such neither does my application. The user is an administrator and the User Account Control (UAC) is set to default on the PC. I turned the UAC completely off, restarted the PC, and everything is working great!

is there something I need to set in AI to make sure that the application is installed such that the user & app have the correct privileges? Or do I simply need to make sure I run the installation via the right click "Run As Administrator"? I believe I just installed it normally under the same user that is running the application (that is an admin). I'm not on any domain or fancy network. Just a plain simple Windows 7 install. Also starting to think that perhaps I need to change up some of the coding practice and perhaps use the "<Username>\AppData\Local\ folder to store the log instead of the app folder itself.

Any help or information would be greatly appreciated.

Kindest Regards,

Frank
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: UAC and Permissions

Hi Frank,
But when I look at the folder where my application got installed, C:\Program Files (x86)\MyApp, I noticed that a folder I told the install to create (called Logs) is not present.
If you specified the folder from the verbose log command line (e.g /L*V "C:\logs\example.log"), please keep in mind that location will not be created if it doesn't already exist. A solution is to create the log files in an existing location on the target machine.
Also starting to think that perhaps I need to change up some of the coding practice and perhaps use the "<Username>\AppData\Local\ folder to store the log instead of the app folder itself.
The correct approach is to install files that require administrative privileges in per-machine locations like CommonAppDataFolder.
Depending on your application's design, you should decide between a per-machine or a per-user install location. The "How do I make the package install per-user or per-machine?" article should help you with this.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FGump
Posts: 65
Joined: Thu Jan 05, 2006 7:23 pm

Re: UAC and Permissions

Thank you for the prompt reply Mihai.

I went ahead and ran the setup (exe) as an Administrator via the right click -> 'Run As Administrator' and it installed fine. I also re-coded my application to use the CSIDL_COMMON_APPDATA folder so that it stores all program settings, logs, etc. in an appropriate application data folder rather than locally to where the EXE is running from. This is a much better approach and should have been this way from the beginning. I was also able to turn the UAC back on to default for each user and it's working great. :)

Kindest Regards,

Frank
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: UAC and Permissions

Hi Frank,

You're welcome glad to help.
I went ahead and ran the setup (exe) as an Administrator via the right click -> 'Run As Administrator' and it installed fine.
This is automatically performed if you enable "Run as administrator" option from Install Parameters page.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FGump
Posts: 65
Joined: Thu Jan 05, 2006 7:23 pm

Re: UAC and Permissions

Thanks again Mihai.
This is automatically performed if you enable "Run as administrator" option from Install Parameters page.
I did not have this checked in my setup. I went ahead and checked it, so hopefully this will help out in the future!


Best Regards,

Frank

Return to “Common Problems”