From 9f8a91562fc3814c927dad4e697a6c0da5ab3626 Mon Sep 17 00:00:00 2001 From: Yvan Duhamel Date: Wed, 16 Jun 2021 15:06:43 +0200 Subject: [PATCH 1/2] Add parameter SkipRegisterAsDistributedCacheHost to SPFarm --- CHANGELOG.md | 5 +++++ .../DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 | 14 +++++++++++++- .../MSFT_SPFarm/MSFT_SPFarm.schema.mof | 1 + SharePointDsc/DSCResources/MSFT_SPFarm/Readme.md | 3 +++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbcb0579f..0aac61b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- SPFarm + - Added parameter SkipRegisterAsDistributedCacheHost + ## [4.7.0] - 2021-06-10 ### Added diff --git a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 index f0b7f0df7..77bb3507e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 @@ -90,6 +90,10 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $ApplicationCredentialKey, + [Parameter()] + [System.Boolean] + $SkipRegisterAsDistributedCacheHost = $false, + [Parameter()] [System.Management.Automation.PSCredential] $InstallAccount @@ -449,6 +453,10 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $ApplicationCredentialKey, + [Parameter()] + [System.Boolean] + $SkipRegisterAsDistributedCacheHost = $false, + [Parameter()] [System.Management.Automation.PSCredential] $InstallAccount @@ -828,7 +836,7 @@ function Set-TargetResource DatabaseServer = $params.DatabaseServer DatabaseName = $params.FarmConfigDatabaseName Passphrase = $params.Passphrase.Password - SkipRegisterAsDistributedCacheHost = $true + SkipRegisterAsDistributedCacheHost = $params.SkipRegisterAsDistributedCacheHost } $supportsSettingApplicationCredentialKey = $false @@ -1306,6 +1314,10 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $ApplicationCredentialKey, + [Parameter()] + [System.Boolean] + $SkipRegisterAsDistributedCacheHost = $false, + [Parameter()] [System.Management.Automation.PSCredential] $InstallAccount diff --git a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof index 6b21c66dd..6caafee26 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof @@ -15,6 +15,7 @@ class MSFT_SPFarm : OMI_BaseResource [Write, Description("SharePoint 2016 & 2019 only - the MinRole role to enroll this server as"), ValueMap{"Application","ApplicationWithSearch","Custom","DistributedCache","Search","SingleServerFarm","WebFrontEnd","WebFrontEndWithDistributedCache"}, Values{"Application","ApplicationWithSearch","Custom","DistributedCache","Search","SingleServerFarm","WebFrontEnd","WebFrontEndWithDistributedCache"}] String ServerRole; [Write, Description("Specifies the state of the Developer Dashboard ('OnDemand' is SP2013 only)"), ValueMap{"Off","On","OnDemand"}, Values{"Off","On","OnDemand"}] String DeveloperDashboard; [Write, Description("Specifies the application credential key on the local server. Only supported for SP2019."), EmbeddedInstance("MSFT_Credential")] String ApplicationCredentialKey; + [Write, Description("Set to true to not register the server computer as a distributed cache host")] Boolean SkipRegisterAsDistributedCacheHost; [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL login to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; diff --git a/SharePointDsc/DSCResources/MSFT_SPFarm/Readme.md b/SharePointDsc/DSCResources/MSFT_SPFarm/Readme.md index 9af563627..7a3605a73 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarm/Readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPFarm/Readme.md @@ -57,6 +57,9 @@ The application credential key will only be set during initial farm creation and when joining the farm. The ApplicationCredentialKey needs to be the same on each server in the farm. ApplicationCredentialKey is only supported for SharePoint 2019. +If SkipRegisterAsDistributedCacheHost is set to true, the server is not registered +as a distributed cache host. + NOTE: When using SharePoint 2016 and later and enabling the Developer Dashboard, please make sure you also provision the Usage and Health service application From 8c651daad44f027e65f9ba67500b758b2a26d2b4 Mon Sep 17 00:00:00 2001 From: Yvan Duhamel Date: Thu, 17 Jun 2021 16:17:22 +0200 Subject: [PATCH 2/2] apply changes as requested --- SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 index 77bb3507e..850ccd2c9 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 @@ -92,7 +92,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $SkipRegisterAsDistributedCacheHost = $false, + $SkipRegisterAsDistributedCacheHost = $true, [Parameter()] [System.Management.Automation.PSCredential] @@ -455,7 +455,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $SkipRegisterAsDistributedCacheHost = $false, + $SkipRegisterAsDistributedCacheHost = $true, [Parameter()] [System.Management.Automation.PSCredential] @@ -475,6 +475,8 @@ function Set-TargetResource throw $message } + $PSBoundParameters.SkipRegisterAsDistributedCacheHost = $SkipRegisterAsDistributedCacheHost + if ($PSBoundParameters.ContainsKey("CentralAdministrationUrl")) { if ([string]::IsNullOrEmpty($CentralAdministrationUrl)) @@ -1316,7 +1318,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $SkipRegisterAsDistributedCacheHost = $false, + $SkipRegisterAsDistributedCacheHost = $true, [Parameter()] [System.Management.Automation.PSCredential]