Sha256: a32635862f93aa85ebb48f29b9411c8f32b2150abd554c7e27a5387bf17f3593

Contents?: true

Size: 1.96 KB

Versions: 346

Compression:

Stored size: 1.96 KB

Contents

function FindIISWebsite 
{
    param($name)

    Import-Module WebAdministration

    Try {
        Get-Item "IIS:\Sites\$name" -Erroraction silentlycontinue
    }
    Catch [System.IO.FileNotFoundException] {
        Get-Item "IIS:\Sites\$name" -Erroraction silentlycontinue
    }
}

function FindIISAppPool
{
    param($name)
    
    Import-Module WebAdministration

    Try {
        Get-Item "IIS:\AppPools\$name" -Erroraction silentlycontinue
    }
    Catch [System.IO.FileNotFoundException] {
        Get-Item "IIS:\AppPools\$name" -Erroraction silentlycontinue

    }
}

function FindSiteBindings
{
    param($name, $protocol, $hostHeader, $port, $ipAddress)

    Import-Module WebAdministration
    Try {
        Get-WebBinding -Name $name -Protocol $protocol -HostHeader $hostHeader -Port $port -IPAddress $ipAddress
    }
    Catch [System.IO.FileNotFoundException] {
        Get-WebBinding -Name $name -Protocol $protocol -HostHeader $hostHeader -Port $port -IPAddress $ipAddress
    }
}

function FindSiteVirtualDir
{
    param($name, $vdir, $path)

    Import-Module WebAdministration

    $webVirtDirPath = [string]::Format('IIS:\Sites\{0}\{1}',$name, $vdir);
    if (Test-Path $webVirtDirPath)
    {
        if ([string]::IsNullOrEmpty($path))
        {
            $true
        }
        else
        {
            (Get-Item $webVirtDirPath).physicalPath -eq $path
        }
    }
    else
    {
        $false
    }
}

function FindSiteApplication
{
    param($name, $app, $pool, $physicalPath)

    Import-Module WebAdministration

    $path = "IIS:\Sites\${name}\${app}"
    $result = $false
    if (Test-Path $path)
    {
        $result = $true
        if ([string]::IsNullOrEmpty($pool) -eq $false)
        {
            $result = $result -and (Get-Item $path).applicationPool -eq $pool
        }

        if ([string]::IsNullOrEmpty($physicalPath) -eq $false)
        {
            $result = $result -and (Get-Item $path).physicalPath -eq $physicalPath
        }
    }

    $result
}

Version data entries

346 entries across 346 versions & 3 rubygems

Version Path
specinfra-2.82.5 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.82.4 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.82.3 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.82.2 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.82.1 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.82.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.81.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.80.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.79.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.78.2 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.78.1 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.78.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.77.3 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.77.2 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.77.1 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.77.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.76.9 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.76.8 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.76.7 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-2.76.6 lib/specinfra/backend/powershell/support/find_iis_component.ps1