Saturday, March 24, 2018

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 application pools and their identities for web applications, but it can be done using 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

Notes

  • This also works for SharePoint 2013 and 2016.

No comments: