function Get-IISSiteList { <# .SYNOPSIS Returns a list of all Alkami sites in IIS .PARAMETER adminSitesOnly [switch] Opens only Admin sites on the server. Cannot be used with the IncludeIPSTS parameter .PARAMETER returnIPSTS [switch] IPSTS is excluded by default, but will be returned if this parameter is set. Cannot be used with the AdminOnly parameter #> [CmdletBinding(DefaultParameterSetName = 'NoParameters')] [CmdletBinding()] Param( [Parameter(ParameterSetName = 'AdminOnly', Mandatory = $true)] [Parameter(Mandatory = $false)] [Alias("AdminOnly")] [switch]$adminSitesOnly, [Parameter(ParameterSetName = 'IncludeIPSTS', Mandatory = $true)] [Parameter(Mandatory = $false)] [Alias("IncludeIPSTS")] [switch]$returnIPSTS ) $mgr = New-Object Microsoft.Web.Administration.ServerManager [Regex]$siteMatchRegex = ".*WebClient.*" if ($adminSitesOnly.IsPresent) { [Regex]$siteMatchRegex = ".*WebClientAdmin$" } elseif ($returnIPSTS.IsPresent) { [Regex]$siteMatchRegex = "(.*WebClient.*|.*IPSTS)" } [array]$sites = $mgr.Sites | Where-Object {$_.Applications["/"].VirtualDirectories["/"].PhysicalPath -match $siteMatchRegex} return $sites }