In my installer, I am installing a few services and then a deploying a website to IIS. In order for my website to work, the application pool user which the website is ran with needs to have permissions to a few folders for it to do its job. When I do this manually, I have to find the folder I want to grant permissions, open the properties for that folder, hit the security tab, click edit, click add, I select the location and make sure I have the correct machine selected. The after that, I type "IIS AppPool\<AppPoolName>" into the text box to the left of the "Check Names" button. After that, I hit check names, Windows does some magic and produces the correct user, I click ok, then select the user in the "Group or user names" box, and then in the permissions box I grant the right to read and modify the directory for that user.
I need to have the installer do that process for me, but I have no clue how to go about doing it. I tried adding this to the permissions tab to the folder that contains my website in Advanced Installer, but during installation I get an error that says, "An error occured while applying security settings. IIS AppPool\<AppPoolName> is not a valid user or group. This could be a problem with the package, or problem connecting to a domain controller on the network. Check your network connection and click "Retry", or "Cancel" to end the install."
Is there a way I can grant these permissions as a script or something after the installation completes?