From 878fe844161b758b29016f22ba1066bbb20ff8ae Mon Sep 17 00:00:00 2001 From: "Hannappel, Christoph" Date: Tue, 8 Mar 2022 16:36:47 +0100 Subject: [PATCH] Fix: use of SecureSocketsLayer on older SharePoint Versions than Subscription Edition --- CHANGELOG.md | 4 ++++ .../MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c76e642e..f85f4ef8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- SPWebApplication + - Fixed an issue where the Set method tried to use the Parameter SecureSocketsLayer with Set-SPWebApplication on SharePoint Server older than Subscription Edition. + ## [5.1.0] - 2022-02-24 ### Added diff --git a/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 index 3acd52cd3..de71eab9f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 @@ -618,10 +618,6 @@ function Set-TargetResource { $updateWebAppParams.Add("AllowLegacyEncryption", $params.AllowLegacyEncryption) } - if ((New-Object -TypeName System.Uri $params.WebAppUrl).Scheme -eq "https") - { - $updateWebAppParams.Add("SecureSocketsLayer", $true) - } $productVersion = Get-SPDscInstalledProductVersion if ($productVersion.FileMajorPart -eq 16 -and ` @@ -636,6 +632,11 @@ function Set-TargetResource { $updateWebAppParams.Add("Port", $params.Port) } + + if ((New-Object -TypeName System.Uri $params.WebAppUrl).Scheme -eq "https") + { + $updateWebAppParams.Add("SecureSocketsLayer", $true) + } } Write-Verbose -Message "Updating web application with these parameters: $(Convert-SPDscHashtableToString -Hashtable $updateWebAppParams)"