18 lines
659 B
PowerShell
18 lines
659 B
PowerShell
|
Function Get-IISAppPoolChildApplicationsCount {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Returns a count of the attached applications (including any root sites) in use by an application pool in IIS.
|
||
|
|
||
|
.PARAMETER $AppPoolName
|
||
|
[string] The name of the application pool in question
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
Param(
|
||
|
[Parameter(Mandatory = $true, Position = 0)]
|
||
|
[string]$AppPoolName
|
||
|
)
|
||
|
process {
|
||
|
## Based off this information https://stackoverflow.com/a/20751426/109749
|
||
|
return @(Get-WebConfigurationProperty "/system.applicationHost/sites/site/application[@applicationPool=`'$appPoolName`']" "machine/webroot/apphost" -name path).Count
|
||
|
}
|
||
|
}
|