SOLVED: Find web sites and applications using a Microsoft IIS server application pool using the IISAdministration PowerShell cmdlets
If you're using the IISAdministration PowerShell module you may want to find out what applications are in use by an application pool.
(if you're using the older WebAdministration module I've written the solution here).
#
Gets the names of the applications in the specified application pool.
Function Get-ApplicationPoolApplicationNames
{
[CmdletBinding()]
param(
[Parameter()]
[System.Object] $ApplicationPoolName
)
process
{
$applicationNames = New-Object System.Collections.Generic.List``1[System.String];
$webSites = Get-IISSite;
foreach ($webSite in $webSites)
{
foreach ($application in $webSite.Applications)
{
if ($application.ApplicationPoolName
-eq $ApplicationPoolName)
{
if ($application.Path
-eq "/")
{
$applicationNames.Add($webSite.Name);
continue;
}
$applicationNames.Add("$($webSite.Name)$($application.Path)");
}
}
}
return $applicationNames;
}
}
The results are returned in the format
While you're here why not check out our IIS Server audit and documentation tool?
Comments
Post a Comment