SharePoint 2010 TIP: List Web Application Pools and Identities using PowerShell
In SharePoint 2010, a single PowerShell commandlet, Get-SPServiceApplicationPool, will list all application pools and their identities for service applications. However, there is no corresponding commandlet for directly listing web application application pools and their identities. Instead, to get these, you need to look into the properties of the web application object itself, in this case, the web application object's ApplicationPool collection, and use a bit of piping:
Get-SPWebApplication | Select-Object DisplayName,{$_.ApplicationPool.Name},{$_.ApplicationPool.ID}, {$_.ApplicationPool.UserName} | ft -auto
If you want to put the output directly into a file, just do this:
Get-SPWebApplication... | Export-CSV -Path "[Path]\FileName.csv]"
The column headers will be the default property names or expressions that you used. You can customize and improve the output column headers by doing this:
Get-SPWebApplication | Select-Object DisplayName, @{N="Application Pool"; E={$_.ApplicationPool.Name}}, @{N="ID";E= {$_.ApplicationPool.ID}}, @{N="Identity"; E={$_.ApplicationPool.UserName}} | ft -auto
If you don't know the other ApplicationPool properties that you can get from Get-SPWebApplication, just do this:
$wa = Get-SPWebApplication -Identity "[web app name]"; $wa.ApplicationPool
References
- Get the application pool for a web application using the IIS7 PowerShell snap-in
- Get All Web Applications in SharePoint using PowerShell
- Finding the application pool account for a web application
- List of Sites and Application pools in IIS
- Get-SPServiceApplicationPool
- Get-SPWebApplication
Notes
- This also works for SharePoint 2013 and 2016.