Sha256: ed5619a493d73cfea888ad98b32fef5cf4ad02678a488a275d2a620d4fbf353e

Contents?: true

Size: 1.69 KB

Versions: 13

Compression:

Stored size: 1.69 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
    
    Get-Item "IIS:\AppPools\$name" -Erroraction silentlycontinue
}

function FindSiteBindings
{
    param($name, $protocol, $hostHeader, $port, $ipAddress)
    
    Import-Module WebAdministration
    
    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

13 entries across 13 versions & 1 rubygems

Version Path
specinfra-1.27.2 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.27.1 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.27.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.26.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.8 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.7 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.6 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.5 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.4 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.3 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.2 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.1 lib/specinfra/backend/powershell/support/find_iis_component.ps1
specinfra-1.25.0 lib/specinfra/backend/powershell/support/find_iis_component.ps1