lib/specinfra/backend/powershell/support/find_iis_component.ps1 in specinfra-1.27.2 vs lib/specinfra/backend/powershell/support/find_iis_component.ps1 in specinfra-1.27.3

- old
+ new

@@ -15,21 +15,30 @@ function FindIISAppPool { param($name) Import-Module WebAdministration - - Get-Item "IIS:\AppPools\$name" -Erroraction silentlycontinue + 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 - - Get-WebBinding -Name $name -Protocol $protocol -HostHeader $hostHeader -Port $port -IPAddress $ipAddress + 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) @@ -75,6 +84,6 @@ $result = $result -and (Get-Item $path).physicalPath -eq $physicalPath } } $result -} \ No newline at end of file +}