Update: The original question was for Windows Server 2008, but the solution is easier for Windows Server 2008 R2 and Windows Server 2012 (and Windows 7 and 8). You can add the user through the NTFS UI by typing it in directly. The name is in the format of IIS APPPOOL\{app pool name}. For example: IIS APPPOOL\DefaultAppPool.
IIS APPPOOL\{app pool name}
Note: Per comments below, there are two things to be aware of:
- Enter the string directly into the "Select User or Group" and not in the search field.
- In a domain environment you need to set the Location to your local computer first.
Reference to Microsoft Docs article: Application Pool Identities > Securing Resources
Original response: (for Windows Server 2008) This is a great feature, but as you mentioned it's not fully implemented yet. You can add the app pool identity from the command prompt with something like icacls, then you can manage it from the GUI. For example, run something like this from the command prompt:
icacls c:\inetpub\wwwroot /grant "IIS APPPOOL\DefaultAppPool":(OI)(CI)(RX)
Then, in Windows Explorer, go to the wwwroot folder and edit the security permissions. You will see what looks like a group (the group icon) called DefaultAppPool. You can now edit the permissions.
However, you don't need to use this at all. It's a bonus that you can use if you want. You can use the old way of creating a custom user per app pool and assigning the custom user to disk. That has full UI support.
This SID injection method is nice because it allows you to use a single user but fully isolate each site from each other without having to create unique users for each app pool. Pretty impressive, and it will be even better with UI support.
Note: If you are unable to find the application pool user, check to see if the Windows service called Application Host Helper Service is running. It's the service that maps application pool users to Windows accounts.
Unfortunately, it isn't possible to load the IIS provider as the same thing on both 2008 and 2008R2. On 2008 the IIS provider is provided as only a snapin, and on 2008R2 it is provided as only a module.
With a little bit of coding, you can actually determine which to use, and dynamically load the module or snapin in your script, depending on which is necessary. I took this code from http://forums.iis.net/t/1166784.aspx when I was having a similar problem.
$ModuleName = "WebAdministration"
$ModuleLoaded = $false
$LoadAsSnapin = $false
if ($PSVersionTable.PSVersion.Major -ge 2) {
if ((Get-Module -ListAvailable | ForEach-Object {$_.Name}) -contains $ModuleName) {
Import-Module $ModuleName
if ((Get-Module | ForEach-Object {$_.Name}) -contains $ModuleName) {
$ModuleLoaded = $true
} else {
$LoadAsSnapin = $true
}
} elseif ((Get-Module | ForEach-Object {$_.Name}) -contains $ModuleName) {
$ModuleLoaded = $true
} else {
$LoadAsSnapin = $true
}
} else {
$LoadAsSnapin = $true
}
if ($LoadAsSnapin) {
if ((Get-PSSnapin -Registered | ForEach-Object {$_.Name}) -contains $ModuleName) {
Add-PSSnapin $ModuleName
if ((Get-PSSnapin | ForEach-Object {$_.Name}) -contains $ModuleName) {
$ModuleLoaded = $true
}
} elseif ((Get-PSSnapin | ForEach-Object {$_.Name}) -contains $ModuleName) {
$ModuleLoaded = $true
}
}
Before attempting to do anything with the IIS provider, check to ensure that $ModuleLoaded
is true, and you should be good to go.
Best Answer
You need to load the snapin containing the cmdlets. (A snapin is the PSH1, supported in V2, means of implementing cmdlets. In V2 modules are a better, more flexible, approach.)
There are some details here: http://learn.iis.net/page.aspx/429/installing-the-iis-70-powershell-snap-in/ which details the shortcut installed which is pre-configured with the snapin loaded.