|
|
|
@@ -129,19 +129,18 @@ function Get-BindingInformation { |
|
|
|
} |
|
|
|
|
|
|
|
function Assert-HostCapabilities { |
|
|
|
$getWindowsFeature = Get-Command Get-WindowsFeature -ErrorAction SilentlyContinue |
|
|
|
$getOptionalFeature = Get-Command Get-WindowsOptionalFeature -ErrorAction SilentlyContinue |
|
|
|
if ($null -ne $getWindowsFeature) { |
|
|
|
$aspFeature = Get-WindowsFeature -Name Web-ASP |
|
|
|
if ($null -eq $aspFeature -or -not $aspFeature.Installed) { throw 'The IIS Classic ASP feature (Web-ASP) is not installed.' } |
|
|
|
} elseif ($null -ne $getOptionalFeature) { |
|
|
|
$aspFeature = Get-WindowsOptionalFeature -Online -FeatureName IIS-ASP -ErrorAction SilentlyContinue |
|
|
|
if ($null -eq $aspFeature -or $aspFeature.State -ne 'Enabled') { throw 'The IIS-ASP Windows feature is not enabled.' } |
|
|
|
} else { |
|
|
|
throw 'Classic ASP feature state cannot be verified: no supported Windows feature cmdlet is available.' |
|
|
|
# Query IIS directly instead of Get-WindowsFeature/Get-WindowsOptionalFeature: |
|
|
|
# those feature cmdlets can stall while collecting server-manager state. |
|
|
|
$aspHandler = (Get-WebConfiguration -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter 'system.webServer/handlers').Collection | |
|
|
|
Where-Object { $_.path -eq '*.asp' -and $_.modules -match '(^|,)IsapiModule(,|$)' -and $_.scriptProcessor -match '(?i)asp\.dll$' } | |
|
|
|
Select-Object -First 1 |
|
|
|
if ($null -eq $aspHandler) { |
|
|
|
throw 'The IIS Classic ASP handler (*.asp through asp.dll) was not found.' |
|
|
|
} |
|
|
|
if ($null -eq (Get-WebGlobalModule -Name AspModule -ErrorAction SilentlyContinue)) { |
|
|
|
throw 'The IIS Classic ASP module (AspModule) was not found.' |
|
|
|
try { |
|
|
|
Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter 'system.webServer/asp' -Name 'enableParentPaths' -ErrorAction Stop | Out-Null |
|
|
|
} catch { |
|
|
|
throw "The IIS Classic ASP configuration section is unavailable: $($_.Exception.Message)" |
|
|
|
} |
|
|
|
if ($null -eq (Get-WebGlobalModule -Name RewriteModule -ErrorAction SilentlyContinue)) { |
|
|
|
throw 'IIS URL Rewrite is not installed (RewriteModule was not found).' |
|
|
|
|