SOLVED: Find web sites and applications using a Microsoft IIS server application pool using the WebAdministration PowerShell cmdlets
If you're using the older WebAdministration PowerShell module for IIS you'll notice when browing application pools you'll see the applications in the pool.
https://learn.microsoft.com/powershell/module/webadministration
#
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-Website;
foreach ($webSite in $webSites)
{
if ($webSite.applicationPool -eq $ApplicationPoolName) { $applicationNames.Add($webSite.Name); }
$applications = Get-WebApplication -Site $webSite.Name;
foreach ($application in $applications)
{
if ($application.applicationPool
-eq $ApplicationPoolName)
{
$applicationNames.Add("$($webSite.Name)$($application.Path)");
}
}
}
return $applicationNames;
}
}
While you're here why not check out our IIS Server audit and documentation tool?
Comments
Post a Comment