To see a list of all application pools in IIS 7.x, run the following command in an elavated priviliges command prompt:
%windir%\system32\inetsrv\appcmd.exe list wp
For IIS 6.x or lesser the corresponding command is iisapp. The list shows application pool number and its name.
To recycle an application pool, use the following syntax:
appcmd recycle apppool /apppool.name: string
Powershell needs to refer to correct assembly to access details of application pools like so:
%windir%\system32\inetsrv\appcmd.exe list wp
For IIS 6.x or lesser the corresponding command is iisapp. The list shows application pool number and its name.
To recycle an application pool, use the following syntax:
appcmd recycle apppool /apppool.name: string
Powershell needs to refer to correct assembly to access details of application pools like so:
[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
$sm = New-Object Microsoft.Web.Administration.ServerManager
foreach($site in $sm.Sites)
{
$root = $site.Applications | where { $_.Path -eq "/" }
Write-Output ("Site: " + $site.Name + " | Pool: " + $root.ApplicationPoolName)
}
No comments:
Post a Comment