Setting file/folder permissions for installed user - Advanced Installer Community
dwoods
Posts: 1
Joined: Sun Sep 05, 2010 2:58 am

Setting file/folder permissions for installed user

Hi,

I am trying to give permissions in the 'Files and Folders' section to a user I created in the 'Users and Groups' section, but every time I try to run the installer, it cannot progress because the user account doesn't exist. I'm guessing it's because the user account gets created after the folder permissions are set?

It seems like there should be a way to set permissions for an installed user (in the same way that I can when I setup IIS identity & authentication settings). I took a look in the documentation but couldn't find any way to accomplish this. Is this possible?

Thanks,
Darryl
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Setting file/folder permissions for installed user

Hi Darryl,

Unfortunately, Windows Installer does not support creating a user and using it to set permissions during the same install process.
A workaround would be to create another install package specially purposed to create the user account. Add this package as a global prerequisite to the main installer.
The prerequisite installs the user, then the main installer installs the folder and sets the permission.
Let me know how that worked for you.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
JDMils
Posts: 50
Joined: Tue Aug 10, 2010 12:42 pm

Re: Setting file/folder permissions for installed user

I know you can run VB scripts in Ai, and there are a lot of scripts on the net which can create a user and place it in a specific local group. This might be a more elegant solution.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Setting file/folder permissions for installed user

Hello,

The user needs to be created before the main MSI installation is started. VBScripts custom actions run during installation, which is why it will not work.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
cminorm
Posts: 30
Joined: Mon Jan 23, 2012 4:13 pm

Re: Setting file/folder permissions for installed user

You can use the following command to set permissions to folders in a custom action
cacls [FOLDER] /G [GROUP]:R /T /E
ocomes
Posts: 2
Joined: Thu May 16, 2013 9:29 am

Re: Setting file/folder permissions for installed user

GabrielBarbu wrote:Hi Darryl,

Unfortunately, Windows Installer does not support creating a user and using it to set permissions during the same install process.
A workaround would be to create another install package specially purposed to create the user account. Add this package as a global prerequisite to the main installer.
The prerequisite installs the user, then the main installer installs the folder and sets the permission.
Let me know how that worked for you.

Best regards,
Gabriel
Hi Gabriel,

when you talk about "package specially purposed to create the user account" do you refer to a package created using AI? If yes, which kind of project?

Thanks
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Setting file/folder permissions for installed user

Hi,
when you talk about "package specially purposed to create the user account" do you refer to a package created using AI?
Yes, a package created with Advanced Installer.
If yes, which kind of project?
You can create a new "Enterprise" project (the "Enterprise" and "Architect" project types have the feature of creating a new user account). Then, you can go to the "Users and Groups" page, in the "System Changes" group page from the left-side pane and create a new user account using the [User] toolbar button.

After that, build the project and add the resulted MSI package as a "Pre-install" prerequisite in the project related to the main installer.

NOTE: Users and Groups can only be created on Windows NT OS family(Windows NT, Windows 2000, Windows XP, etc).

Let us know if this helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”