From 11476151f752c275f80f89142e9356b5d9058b3a Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Tue, 25 Apr 2023 09:19:04 +0200 Subject: [PATCH 1/3] Fixes #1399 --- ...MSFT_SPDistributedCacheClientSettings.psm1 | 805 +++++++++++++++--- ...PDistributedCacheClientSettings.schema.mof | 27 + .../Readme.md | 39 +- ...SPDistributedCacheClientSettings.Tests.ps1 | 66 +- 4 files changed, 830 insertions(+), 107 deletions(-) diff --git a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 index 64fc72fd1..752f3116d 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 @@ -187,7 +187,115 @@ function Get-TargetResource [Parameter()] [System.UInt32] - $DHSCChannelOpenTimeOut + $DHSCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DDBFCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DDBFCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DDBFCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DEHCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DEHCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DEHCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DFSPTCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DFSPTCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DFSPTCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPABSCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPABSCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPABSCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPCVCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPCVCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPCVCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPOATCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPOATCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPOATCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSGCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSGCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSGCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DUACMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DUACRequestTimeout, + + [Parameter()] + [System.UInt32] + $DUACChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DUAuCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DUAuCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DUAuCChannelOpenTimeOut ) Write-Verbose -Message "Getting the Distributed Cache Client Settings" @@ -225,57 +333,134 @@ function Get-TargetResource } } + if ($PSBoundParameters.ContainsKey("DDBFCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DDBFCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DDBFCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DEHCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DEHCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DEHCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DFSPTCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DFSPTCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DFSPTCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DSPABSCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DSPABSCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DSPABSCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DSPCVCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DSPCVCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DSPCVCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DSPOATCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DSPOATCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DSPOATCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DSGCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DSGCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DSGCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DUACMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DUACRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DUACChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DUAuCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DUAuCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DUAuCChannelOpenTimeOut") -eq $true) + { + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.FileMajorPart -eq 15 -or ` + $installedVersion.ProductBuildPart.ToString().Length -eq 4) + { + $message = ("The following parameters are only supported in SharePoint 2019 and above: " + ` + "DDBFCMaxConnectionsToServer, DDBFCRequestTimeout, DDBFCChannelOpenTimeOut, " + ` + "DEHCMaxConnectionsToServer, DEHCRequestTimeout, DEHCChannelOpenTimeOut, " + ` + "DFSPTCMaxConnectionsToServer, DFSPTCRequestTimeout, DFSPTCChannelOpenTimeOut, " + ` + "DSPABSCMaxConnectionsToServer, DSPABSCRequestTimeout, DSPABSCChannelOpenTimeOut, " + ` + "DSPCVCMaxConnectionsToServer, DSPCVCRequestTimeout, DSPCVCChannelOpenTimeOut, " + ` + "DSPOATCMaxConnectionsToServer, DSPOATCRequestTimeout, DSPOATCChannelOpenTimeOut, " + ` + "DSGCMaxConnectionsToServer, DSGCRequestTimeout, DSGCChannelOpenTimeOut, " + ` + "DUACMaxConnectionsToServer, DUACRequestTimeout, DUACChannelOpenTimeOut, " + ` + "DUAuCMaxConnectionsToServer, DUAuCRequestTimeout, DUAuCChannelOpenTimeOut") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $nullReturnValue = @{ - IsSingleInstance = "Yes" - DLTCMaxConnectionsToServer = $null - DLTCRequestTimeout = $null - DLTCChannelOpenTimeOut = $null - DVSCMaxConnectionsToServer = $null - DVSCRequestTimeout = $null - DVSCChannelOpenTimeOut = $null - DACMaxConnectionsToServer = $null - DACRequestTimeout = $null - DACChannelOpenTimeOut = $null - DAFMaxConnectionsToServer = $null - DAFRequestTimeout = $null - DAFChannelOpenTimeOut = $null - DAFCMaxConnectionsToServer = $null - DAFCRequestTimeout = $null - DAFCChannelOpenTimeOut = $null - DBCMaxConnectionsToServer = $null - DBCRequestTimeout = $null - DBCChannelOpenTimeOut = $null - DDCMaxConnectionsToServer = $null - DDCRequestTimeout = $null - DDCChannelOpenTimeOut = $null - DSCMaxConnectionsToServer = $null - DSCRequestTimeout = $null - DSCChannelOpenTimeOut = $null - DTCMaxConnectionsToServer = $null - DTCRequestTimeout = $null - DTCChannelOpenTimeOut = $null - DSTACMaxConnectionsToServer = $null - DSTACRequestTimeout = $null - DSTACChannelOpenTimeOut = $null - DFLTCMaxConnectionsToServer = $null - DFLTCRequestTimeout = $null - DFLTCChannelOpenTimeOut = $null - DSWUCMaxConnectionsToServer = $null - DSWUCRequestTimeout = $null - DSWUCChannelOpenTimeOut = $null - DUGCMaxConnectionsToServer = $null - DUGCRequestTimeout = $null - DUGCChannelOpenTimeOut = $null - DRTCMaxConnectionsToServer = $null - DRTCRequestTimeout = $null - DRTCChannelOpenTimeOut = $null - DHSCMaxConnectionsToServer = $null - DHSCRequestTimeout = $null - DHSCChannelOpenTimeOut = $null + IsSingleInstance = "Yes" + DLTCMaxConnectionsToServer = $null + DLTCRequestTimeout = $null + DLTCChannelOpenTimeOut = $null + DVSCMaxConnectionsToServer = $null + DVSCRequestTimeout = $null + DVSCChannelOpenTimeOut = $null + DACMaxConnectionsToServer = $null + DACRequestTimeout = $null + DACChannelOpenTimeOut = $null + DAFMaxConnectionsToServer = $null + DAFRequestTimeout = $null + DAFChannelOpenTimeOut = $null + DAFCMaxConnectionsToServer = $null + DAFCRequestTimeout = $null + DAFCChannelOpenTimeOut = $null + DBCMaxConnectionsToServer = $null + DBCRequestTimeout = $null + DBCChannelOpenTimeOut = $null + DDCMaxConnectionsToServer = $null + DDCRequestTimeout = $null + DDCChannelOpenTimeOut = $null + DSCMaxConnectionsToServer = $null + DSCRequestTimeout = $null + DSCChannelOpenTimeOut = $null + DTCMaxConnectionsToServer = $null + DTCRequestTimeout = $null + DTCChannelOpenTimeOut = $null + DSTACMaxConnectionsToServer = $null + DSTACRequestTimeout = $null + DSTACChannelOpenTimeOut = $null + DFLTCMaxConnectionsToServer = $null + DFLTCRequestTimeout = $null + DFLTCChannelOpenTimeOut = $null + DSWUCMaxConnectionsToServer = $null + DSWUCRequestTimeout = $null + DSWUCChannelOpenTimeOut = $null + DUGCMaxConnectionsToServer = $null + DUGCRequestTimeout = $null + DUGCChannelOpenTimeOut = $null + DRTCMaxConnectionsToServer = $null + DRTCRequestTimeout = $null + DRTCChannelOpenTimeOut = $null + DHSCMaxConnectionsToServer = $null + DHSCRequestTimeout = $null + DHSCChannelOpenTimeOut = $null + DDBFCMaxConnectionsToServer = $null + DDBFCRequestTimeout = $null + DDBFCChannelOpenTimeOut = $null + DEHCMaxConnectionsToServer = $null + DEHCRequestTimeout = $null + DEHCChannelOpenTimeOut = $null + DFSPTCMaxConnectionsToServer = $null + DFSPTCRequestTimeout = $null + DFSPTCChannelOpenTimeOut = $null + DSPABSCMaxConnectionsToServer = $null + DSPABSCRequestTimeout = $null + DSPABSCChannelOpenTimeOut = $null + DSPCVCMaxConnectionsToServer = $null + DSPCVCRequestTimeout = $null + DSPCVCChannelOpenTimeOut = $null + DSPOATCMaxConnectionsToServer = $null + DSPOATCRequestTimeout = $null + DSPOATCChannelOpenTimeOut = $null + DSGCMaxConnectionsToServer = $null + DSGCRequestTimeout = $null + DSGCChannelOpenTimeOut = $null + DUACMaxConnectionsToServer = $null + DUACRequestTimeout = $null + DUACChannelOpenTimeOut = $null + DUAuCMaxConnectionsToServer = $null + DUAuCRequestTimeout = $null + DUAuCChannelOpenTimeOut = $null } try @@ -295,54 +480,90 @@ function Get-TargetResource $DUGC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedUnifiedGroupsCache" $DRTC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedResourceTallyCache" $DHSC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedHealthScoreCache" + $DDBFC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedDbLevelFailoverCache" + $DEHC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedEdgeHeaderCache" + $DFSPTC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedFileStorePerformanceTraceCache" + $DSPABSC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedSPAbsBlobCache" + $DSPCVC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedSPCertificateValidatorCache" + $DSPOATC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedSPOAuthTokenCache" + $DSGC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedStopgapCache" + $DUAC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedUnifiedAppsCache" + $DUAuC = Get-SPDistributedCacheClientSetting -ContainerType "DistributedUnifiedAuditCache" $returnValue = @{ - IsSingleInstance = "Yes" - DLTCMaxConnectionsToServer = $DLTC.MaxConnectionsToServer - DLTCRequestTimeout = $DLTC.RequestTimeout - DLTCChannelOpenTimeOut = $DLTC.ChannelOpenTimeOut - DVSCMaxConnectionsToServer = $DVSC.MaxConnectionsToServer - DVSCRequestTimeout = $DVSC.RequestTimeout - DVSCChannelOpenTimeOut = $DVSC.ChannelOpenTimeOut - DACMaxConnectionsToServer = $DAC.MaxConnectionsToServer - DACRequestTimeout = $DAC.RequestTimeout - DACChannelOpenTimeOut = $DAC.ChannelOpenTimeOut - DAFMaxConnectionsToServer = $DAF.MaxConnectionsToServer - DAFRequestTimeout = $DAF.RequestTimeout - DAFChannelOpenTimeOut = $DAF.ChannelOpenTimeOut - DAFCMaxConnectionsToServer = $DAFC.MaxConnectionsToServer - DAFCRequestTimeout = $DAFC.RequestTimeout - DAFCChannelOpenTimeOut = $DAFC.ChannelOpenTimeOut - DBCMaxConnectionsToServer = $DBC.MaxConnectionsToServer - DBCRequestTimeout = $DBC.RequestTimeout - DBCChannelOpenTimeOut = $DBC.ChannelOpenTimeOut - DDCMaxConnectionsToServer = $DDC.MaxConnectionsToServer - DDCRequestTimeout = $DDC.RequestTimeout - DDCChannelOpenTimeOut = $DDC.ChannelOpenTimeOut - DSCMaxConnectionsToServer = $DSC.MaxConnectionsToServer - DSCRequestTimeout = $DSC.RequestTimeout - DSCChannelOpenTimeOut = $DSC.ChannelOpenTimeOut - DTCMaxConnectionsToServer = $DTC.MaxConnectionsToServer - DTCRequestTimeout = $DTC.RequestTimeout - DTCChannelOpenTimeOut = $DTC.ChannelOpenTimeOut - DSTACMaxConnectionsToServer = $DSTAC.MaxConnectionsToServer - DSTACRequestTimeout = $DSTAC.RequestTimeout - DSTACChannelOpenTimeOut = $DSTAC.ChannelOpenTimeOut - DFLTCMaxConnectionsToServer = $DFLTC.MaxConnectionsToServer - DFLTCRequestTimeout = $DFLTC.RequestTimeout - DFLTCChannelOpenTimeOut = $DFLTC.ChannelOpenTimeOut - DSWUCMaxConnectionsToServer = $DSWUC.MaxConnectionsToServer - DSWUCRequestTimeout = $DSWUC.RequestTimeout - DSWUCChannelOpenTimeOut = $DSWUC.ChannelOpenTimeOut - DUGCMaxConnectionsToServer = $DUGC.MaxConnectionsToServer - DUGCRequestTimeout = $DUGC.RequestTimeout - DUGCChannelOpenTimeOut = $DUGC.ChannelOpenTimeOut - DRTCMaxConnectionsToServer = $DRTC.MaxConnectionsToServer - DRTCRequestTimeout = $DRTC.RequestTimeout - DRTCChannelOpenTimeOut = $DRTC.ChannelOpenTimeOut - DHSCMaxConnectionsToServer = $DHSC.MaxConnectionsToServer - DHSCRequestTimeout = $DHSC.RequestTimeout - DHSCChannelOpenTimeOut = $DHSC.ChannelOpenTimeOut + IsSingleInstance = "Yes" + DLTCMaxConnectionsToServer = $DLTC.MaxConnectionsToServer + DLTCRequestTimeout = $DLTC.RequestTimeout + DLTCChannelOpenTimeOut = $DLTC.ChannelOpenTimeOut + DVSCMaxConnectionsToServer = $DVSC.MaxConnectionsToServer + DVSCRequestTimeout = $DVSC.RequestTimeout + DVSCChannelOpenTimeOut = $DVSC.ChannelOpenTimeOut + DACMaxConnectionsToServer = $DAC.MaxConnectionsToServer + DACRequestTimeout = $DAC.RequestTimeout + DACChannelOpenTimeOut = $DAC.ChannelOpenTimeOut + DAFMaxConnectionsToServer = $DAF.MaxConnectionsToServer + DAFRequestTimeout = $DAF.RequestTimeout + DAFChannelOpenTimeOut = $DAF.ChannelOpenTimeOut + DAFCMaxConnectionsToServer = $DAFC.MaxConnectionsToServer + DAFCRequestTimeout = $DAFC.RequestTimeout + DAFCChannelOpenTimeOut = $DAFC.ChannelOpenTimeOut + DBCMaxConnectionsToServer = $DBC.MaxConnectionsToServer + DBCRequestTimeout = $DBC.RequestTimeout + DBCChannelOpenTimeOut = $DBC.ChannelOpenTimeOut + DDCMaxConnectionsToServer = $DDC.MaxConnectionsToServer + DDCRequestTimeout = $DDC.RequestTimeout + DDCChannelOpenTimeOut = $DDC.ChannelOpenTimeOut + DSCMaxConnectionsToServer = $DSC.MaxConnectionsToServer + DSCRequestTimeout = $DSC.RequestTimeout + DSCChannelOpenTimeOut = $DSC.ChannelOpenTimeOut + DTCMaxConnectionsToServer = $DTC.MaxConnectionsToServer + DTCRequestTimeout = $DTC.RequestTimeout + DTCChannelOpenTimeOut = $DTC.ChannelOpenTimeOut + DSTACMaxConnectionsToServer = $DSTAC.MaxConnectionsToServer + DSTACRequestTimeout = $DSTAC.RequestTimeout + DSTACChannelOpenTimeOut = $DSTAC.ChannelOpenTimeOut + DFLTCMaxConnectionsToServer = $DFLTC.MaxConnectionsToServer + DFLTCRequestTimeout = $DFLTC.RequestTimeout + DFLTCChannelOpenTimeOut = $DFLTC.ChannelOpenTimeOut + DSWUCMaxConnectionsToServer = $DSWUC.MaxConnectionsToServer + DSWUCRequestTimeout = $DSWUC.RequestTimeout + DSWUCChannelOpenTimeOut = $DSWUC.ChannelOpenTimeOut + DUGCMaxConnectionsToServer = $DUGC.MaxConnectionsToServer + DUGCRequestTimeout = $DUGC.RequestTimeout + DUGCChannelOpenTimeOut = $DUGC.ChannelOpenTimeOut + DRTCMaxConnectionsToServer = $DRTC.MaxConnectionsToServer + DRTCRequestTimeout = $DRTC.RequestTimeout + DRTCChannelOpenTimeOut = $DRTC.ChannelOpenTimeOut + DHSCMaxConnectionsToServer = $DHSC.MaxConnectionsToServer + DHSCRequestTimeout = $DHSC.RequestTimeout + DHSCChannelOpenTimeOut = $DHSC.ChannelOpenTimeOut + DDBFCMaxConnectionsToServer = $DDBFC.MaxConnectionsToServer + DDBFCRequestTimeout = $DDBFC.RequestTimeout + DDBFCChannelOpenTimeOut = $DDBFC.ChannelOpenTimeOut + DEHCMaxConnectionsToServer = $DEHC.MaxConnectionsToServer + DEHCRequestTimeout = $DEHC.RequestTimeout + DEHCChannelOpenTimeOut = $DEHC.ChannelOpenTimeOut + DFSPTCMaxConnectionsToServer = $DFSPTC.MaxConnectionsToServer + DFSPTCRequestTimeout = $DFSPTC.RequestTimeout + DFSPTCChannelOpenTimeOut = $DFSPTC.ChannelOpenTimeOut + DSPABSCMaxConnectionsToServer = $DSPABSC.MaxConnectionsToServer + DSPABSCRequestTimeout = $DSPABSC.RequestTimeout + DSPABSCChannelOpenTimeOut = $DSPABSC.ChannelOpenTimeOut + DSPCVCMaxConnectionsToServer = $DSPCVC.MaxConnectionsToServer + DSPCVCRequestTimeout = $DSPCVC.RequestTimeout + DSPCVCChannelOpenTimeOut = $DSPCVC.ChannelOpenTimeOut + DSPOATCMaxConnectionsToServer = $DSPOATC.MaxConnectionsToServer + DSPOATCRequestTimeout = $DSPOATC.RequestTimeout + DSPOATCChannelOpenTimeOut = $DSPOATC.ChannelOpenTimeOut + DSGCMaxConnectionsToServer = $DSGC.MaxConnectionsToServer + DSGCRequestTimeout = $DSGC.RequestTimeout + DSGCChannelOpenTimeOut = $DSGC.ChannelOpenTimeOut + DUACMaxConnectionsToServer = $DUAC.MaxConnectionsToServer + DUACRequestTimeout = $DUAC.RequestTimeout + DUACChannelOpenTimeOut = $DUAC.ChannelOpenTimeOut + DUAuCMaxConnectionsToServer = $DUAuC.MaxConnectionsToServer + DUAuCRequestTimeout = $DUAuC.RequestTimeout + DUAuCChannelOpenTimeOut = $DUAuC.ChannelOpenTimeOut } return $returnValue } @@ -543,7 +764,115 @@ function Set-TargetResource [Parameter()] [System.UInt32] - $DHSCChannelOpenTimeOut = 20 + $DHSCChannelOpenTimeOut = 20, + + [Parameter()] + [System.UInt32] + $DDBFCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DDBFCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DDBFCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DEHCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DEHCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DEHCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DFSPTCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DFSPTCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DFSPTCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPABSCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPABSCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPABSCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPCVCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPCVCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPCVCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPOATCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPOATCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPOATCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSGCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSGCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSGCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DUACMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DUACRequestTimeout, + + [Parameter()] + [System.UInt32] + $DUACChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DUAuCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DUAuCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DUAuCChannelOpenTimeOut ) Write-Verbose -Message "Setting the Distributed Cache Client Settings" @@ -830,6 +1159,155 @@ function Set-TargetResource } Set-SPDistributedCacheClientSetting -ContainerType "DistributedHealthScoreCache" $DHSC } + + # The following parameters are only required on SharePoint 2019 and above + if ($installedVersion.FileMajorPart -eq 16 -and ` + $installedVersion.ProductBuildPart.ToString().Length -gt 4) + { + #DistributedDbLevelFailoverCache + $DDBFC = Get-SPDistributedCacheClientSetting -ContainerType DistributedDbLevelFailoverCache + if ($params.DDBFCMaxConnectionsToServer) + { + $DDBFC.MaxConnectionsToServer = $params.DDBFCMaxConnectionsToServer + } + if ($params.DDBFCRequestTimeout) + { + $DDBFC.RequestTimeout = $params.DDBFCRequestTimeout + } + if ($params.DDBFCChannelOpenTimeOut) + { + $DDBFC.ChannelOpenTimeOut = $params.DDBFCChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedDbLevelFailoverCache" $DDBFC + + #DistributedEdgeHeaderCache + $DEHC = Get-SPDistributedCacheClientSetting -ContainerType DistributedEdgeHeaderCache + if ($params.DEHCMaxConnectionsToServer) + { + $DEHC.MaxConnectionsToServer = $params.DEHCMaxConnectionsToServer + } + if ($params.DEHCRequestTimeout) + { + $DEHC.RequestTimeout = $params.DEHCRequestTimeout + } + if ($params.DEHCChannelOpenTimeOut) + { + $DEHC.ChannelOpenTimeOut = $params.DEHCChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedEdgeHeaderCache" $DEHC + + #DistributedFileStorePerformanceTraceCache + $DFSPTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedFileStorePerformanceTraceCache + if ($params.DFSPTCMaxConnectionsToServer) + { + $DFSPTC.MaxConnectionsToServer = $params.DFSPTCMaxConnectionsToServer + } + if ($params.DFSPTCRequestTimeout) + { + $DFSPTC.RequestTimeout = $params.DFSPTCRequestTimeout + } + if ($params.DFSPTCChannelOpenTimeOut) + { + $DFSPTC.ChannelOpenTimeOut = $params.DFSPTCChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedFileStorePerformanceTraceCache" $DFSPTC + + #DistributedSPAbsBlobCache + $DSPABSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSPAbsBlobCache + if ($params.DSPABSCMaxConnectionsToServer) + { + $DSPABSC.MaxConnectionsToServer = $params.DSPABSCMaxConnectionsToServer + } + if ($params.DSPABSCRequestTimeout) + { + $DSPABSC.RequestTimeout = $params.DSPABSCRequestTimeout + } + if ($params.DSPABSCChannelOpenTimeOut) + { + $DSPABSC.ChannelOpenTimeOut = $params.DSPABSCChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedSPAbsBlobCache" $DSPABSC + + #DistributedSPCertificateValidatorCache + $DSPCVC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSPCertificateValidatorCache + if ($params.DSPCVCMaxConnectionsToServer) + { + $DSPCVC.MaxConnectionsToServer = $params.DSPCVCMaxConnectionsToServer + } + if ($params.DSPCVCRequestTimeout) + { + $DSPCVC.RequestTimeout = $params.DSPCVCRequestTimeout + } + if ($params.DSPCVCChannelOpenTimeOut) + { + $DSPCVC.ChannelOpenTimeOut = $params.DSPCVCChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedSPCertificateValidatorCache" $DSPCVC + + #DistributedSPOAuthTokenCache + $DSPOATC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSPOAuthTokenCache + if ($params.DSPOATCMaxConnectionsToServer) + { + $DSPOATC.MaxConnectionsToServer = $params.DSPOATCMaxConnectionsToServer + } + if ($params.DSPOATCRequestTimeout) + { + $DSPOATC.RequestTimeout = $params.DSPOATCRequestTimeout + } + if ($params.DSPOATCChannelOpenTimeOut) + { + $DSPOATC.ChannelOpenTimeOut = $params.DSPOATCChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedSPOAuthTokenCache" $DSPOATC + + #DistributedStopgapCache + $DSGC = Get-SPDistributedCacheClientSetting -ContainerType DistributedStopgapCache + if ($params.DSGCMaxConnectionsToServer) + { + $DSGC.MaxConnectionsToServer = $params.DSGCMaxConnectionsToServer + } + if ($params.DSGCRequestTimeout) + { + $DSGC.RequestTimeout = $params.DSGCRequestTimeout + } + if ($params.DSGCChannelOpenTimeOut) + { + $DSGC.ChannelOpenTimeOut = $params.DSGCChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedStopgapCache" $DSGC + + #DistributedUnifiedAppsCache + $DUAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedAppsCache + if ($params.DUACMaxConnectionsToServer) + { + $DUAC.MaxConnectionsToServer = $params.DUACMaxConnectionsToServer + } + if ($params.DUACRequestTimeout) + { + $DUAC.RequestTimeout = $params.DUACRequestTimeout + } + if ($params.DUACChannelOpenTimeOut) + { + $DUAC.ChannelOpenTimeOut = $params.DUACChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedUnifiedAppsCache" $DUAC + + #DistributedUnifiedAuditCache + $DUAuC = Get-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedAuditCache + if ($params.DUAuCMaxConnectionsToServer) + { + $DUAuC.MaxConnectionsToServer = $params.DUAuCMaxConnectionsToServer + } + if ($params.DUAuCRequestTimeout) + { + $DUAuC.RequestTimeout = $params.DUAuCRequestTimeout + } + if ($params.DUAuCChannelOpenTimeOut) + { + $DUAuC.ChannelOpenTimeOut = $params.DUAuCChannelOpenTimeOut + } + Set-SPDistributedCacheClientSetting -ContainerType "DistributedUnifiedAuditCache" $DUAuC + } } } @@ -1022,7 +1500,115 @@ function Test-TargetResource [Parameter()] [System.UInt32] - $DHSCChannelOpenTimeOut + $DHSCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DDBFCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DDBFCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DDBFCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DEHCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DEHCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DEHCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DFSPTCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DFSPTCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DFSPTCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPABSCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPABSCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPABSCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPCVCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPCVCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPCVCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSPOATCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSPOATCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSPOATCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DSGCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DSGCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DSGCChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DUACMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DUACRequestTimeout, + + [Parameter()] + [System.UInt32] + $DUACChannelOpenTimeOut, + + [Parameter()] + [System.UInt32] + $DUAuCMaxConnectionsToServer, + + [Parameter()] + [System.UInt32] + $DUAuCRequestTimeout, + + [Parameter()] + [System.UInt32] + $DUAuCChannelOpenTimeOut ) Write-Verbose -Message "Testing the Distributed Cache Client Settings" @@ -1079,7 +1665,34 @@ function Test-TargetResource "DRTCChannelOpenTimeOut", "DHSCMaxConnectionsToServer", "DHSCRequestTimeout", - "DHSCChannelOpenTimeOut" + "DHSCChannelOpenTimeOut", + 'DDBFCMaxConnectionsToServer', + 'DDBFCRequestTimeout', + 'DDBFCChannelOpenTimeOut', + 'DEHCMaxConnectionsToServer', + 'DEHCRequestTimeout', + 'DEHCChannelOpenTimeOut', + 'DFSPTCMaxConnectionsToServer', + 'DFSPTCRequestTimeout', + 'DFSPTCChannelOpenTimeOut', + 'DSPABSCMaxConnectionsToServer', + 'DSPABSCRequestTimeout', + 'DSPABSCChannelOpenTimeOut', + 'DSPCVCMaxConnectionsToServer', + 'DSPCVCRequestTimeout', + 'DSPCVCChannelOpenTimeOut', + 'DSPOATCMaxConnectionsToServer', + 'DSPOATCRequestTimeout', + 'DSPOATCChannelOpenTimeOut', + 'DSGCMaxConnectionsToServer', + 'DSGCRequestTimeout', + 'DSGCChannelOpenTimeOut', + 'DUACMaxConnectionsToServer', + 'DUACRequestTimeout', + 'DUACChannelOpenTimeOut', + 'DUAuCMaxConnectionsToServer', + 'DUAuCRequestTimeout', + 'DUAuCChannelOpenTimeOut' ) Write-Verbose -Message "Test-TargetResource returned $result" diff --git a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.schema.mof index 90accdf0a..e689543dd 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.schema.mof @@ -47,4 +47,31 @@ class MSFT_SPDistributedCacheClientSettings : OMI_BaseResource [Write, Description("Maximum number of connections to the Distributed Health Score Cache (SP2016 and above)")] UInt32 DHSCMaxConnectionsToServer; [Write, Description("Request timeout for the Distributed Health Score Cache (SP2016 and above)")] UInt32 DHSCRequestTimeout; [Write, Description("Channel timeout for the Distributed Health Score Cache (SP2016 and above)")] UInt32 DHSCChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed Db Level Failover Cache (SP2019 and above)")] UInt32 DDBFCMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed Db Level Failover Cache (SP2019 and above)")] UInt32 DDBFCRequestTimeout; + [Write, Description("Channel timeout for the Distributed Db Level Failover Cache (SP2019 and above)")] UInt32 DDBFCChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed Edge Header Cache (SP2019 and above)")] UInt32 DEHCMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed Edge Header Cache (SP2019 and above)")] UInt32 DEHCRequestTimeout; + [Write, Description("Channel timeout for the Distributed Edge Header Cache (SP2019 and above)")] UInt32 DEHCChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed File Store Performance Trace Cache (SP2019 and above)")] UInt32 DFSPTCMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed File Store Performance Trace Cache (SP2019 and above)")] UInt32 DFSPTCRequestTimeout; + [Write, Description("Channel timeout for the Distributed File Store Performance Trace Cache (SP2019 and above)")] UInt32 DFSPTCChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed SP Abs Blob Cache (SP2019 and above)")] UInt32 DSPABSCMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed SP Abs Blob Cache (SP2019 and above)")] UInt32 DSPABSCRequestTimeout; + [Write, Description("Channel timeout for the Distributed SP Abs Blob Cache (SP2019 and above)")] UInt32 DSPABSCChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed SP Certificate Validator Cache (SP2019 and above)")] UInt32 DSPCVCMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed SP Certificate Validator Cache (SP2019 and above)")] UInt32 DSPCVCRequestTimeout; + [Write, Description("Channel timeout for the Distributed SP Certificate Validator Cache (SP2019 and above)")] UInt32 DSPCVCChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed SP OAuth Token Cache (SP2019 and above)")] UInt32 DSPOATCMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed SP OAuth Token Cache (SP2019 and above)")] UInt32 DSPOATCRequestTimeout; + [Write, Description("Channel timeout for the Distributed SP OAuth Token Cache (SP2019 and above)")] UInt32 DSPOATCChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed Stop Gap Cache (SP2019 and above)")] UInt32 DSGCMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed Stop Gap Cache (SP2019 and above)")] UInt32 DSGCRequestTimeout; + [Write, Description("Channel timeout for the Distributed Stop Gap Cache (SP2019 and above)")] UInt32 DSGCChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed Unified Apps Cache (SP2019 and above)")] UInt32 DUACMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed Unified Apps Cache (SP2019 and above)")] UInt32 DUACRequestTimeout; + [Write, Description("Channel timeout for the Distributed Unified Apps Cache (SP2019 and above)")] UInt32 DUACChannelOpenTimeOut; + [Write, Description("Maximum number of connections to the Distributed Unified Audit Cache (SP2019 and above)")] UInt32 DUAuCMaxConnectionsToServer; + [Write, Description("Request timeout for the Distributed Unified Audit Cache (SP2019 and above)")] UInt32 DUAuCRequestTimeout; + [Write, Description("Channel timeout for the Distributed Unified Audit Cache (SP2019 and above)")] UInt32 DUAuCChannelOpenTimeOut; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/Readme.md b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/Readme.md index 4061937cd..f09e0110e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/Readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/Readme.md @@ -6,13 +6,32 @@ This resource is responsible for configuring the distributed cache client settings. It only accepts Ensure='Present' as a key. The resource can configure the following cache components: -- DistributedLogonTokenCache -- DistributedViewStateCache -- DistributedAccessCache -- DistributedActivityFeedCache -- DistributedActivityFeedLMTCache -- DistributedBouncerCache -- DistributedDefaultCache -- DistributedSearchCache -- DistributedSecurityTrimmingCache -- DistributedServerToAppServerAccessTokenCache. +- All SharePoint versions: + - DistributedLogonTokenCache + - DistributedViewStateCache + - DistributedAccessCache + - DistributedActivityFeedCache + - DistributedActivityFeedLMTCache + - DistributedBouncerCache + - DistributedDefaultCache + - DistributedSearchCache + - DistributedSecurityTrimmingCache + - DistributedServerToAppServerAccessTokenCache. +- SharePoint 2016 and above + - DistributedFileLockThrottlerCache + - DistributedSharedWithUserCache + - DistributedUnifiedGroupsCache + - DistributedResourceTallyCache + - DistributedHealthScoreCache +- SharePoint 2019 and above + - DistributedDbLevelFailoverCache + - DistributedEdgeHeaderCache + - DistributedFileStorePerformanceTraceCache + - DistributedSPAbsBlobCache + - DistributedSPCertificateValidatorCache + - DistributedSPOAuthTokenCache + - DistributedStopgapCache + - DistributedUnifiedAppsCache + - DistributedUnifiedAuditCache + +More information: https://learn.microsoft.com/en-us/sharepoint/administration/manage-the-distributed-cache-service diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 index 4eb6b3c9c..0e11e1fb5 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 @@ -50,7 +50,7 @@ try InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope + Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope # Mocks for all contexts Mock -CommandName Set-SPDistributedCacheClientSetting { } @@ -141,6 +141,38 @@ try $testparams.add("DHSCRequestTimeout", 1000) $testparams.add("DHSCChannelOpenTimeOut", 1000) } + + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + $testparams.add("DDBFCMaxConnectionsToServer", 3) + $testparams.add("DDBFCRequestTimeout", 1000) + $testparams.add("DDBFCChannelOpenTimeOut", 1000) + $testparams.add("DEHCMaxConnectionsToServer", 3) + $testparams.add("DEHCRequestTimeout", 1000) + $testparams.add("DEHCChannelOpenTimeOut", 1000) + $testparams.add("DFSPTCMaxConnectionsToServer", 3) + $testparams.add("DFSPTCRequestTimeout", 1000) + $testparams.add("DFSPTCChannelOpenTimeOut", 1000) + $testparams.add("DSPABSCMaxConnectionsToServer", 3) + $testparams.add("DSPABSCRequestTimeout", 1000) + $testparams.add("DSPABSCChannelOpenTimeOut", 1000) + $testparams.add("DSPCVCMaxConnectionsToServer", 3) + $testparams.add("DSPCVCRequestTimeout", 1000) + $testparams.add("DSPCVCChannelOpenTimeOut", 1000) + $testparams.add("DSPOATCMaxConnectionsToServer", 3) + $testparams.add("DSPOATCRequestTimeout", 1000) + $testparams.add("DSPOATCChannelOpenTimeOut", 1000) + $testparams.add("DSGCMaxConnectionsToServer", 3) + $testparams.add("DSGCRequestTimeout", 1000) + $testparams.add("DSGCChannelOpenTimeOut", 1000) + $testparams.add("DUACMaxConnectionsToServer", 3) + $testparams.add("DUACRequestTimeout", 1000) + $testparams.add("DUACChannelOpenTimeOut", 1000) + $testparams.add("DUAuCMaxConnectionsToServer", 3) + $testparams.add("DUAuCRequestTimeout", 1000) + $testparams.add("DUAuCChannelOpenTimeOut", 1000) + } } It "Should return DLTCMaxConnectionsToServer equals 5" { @@ -219,6 +251,38 @@ try $testparams.add("DHSCRequestTimeout", 3000) $testparams.add("DHSCChannelOpenTimeOut", 3000) } + + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + $testparams.add("DDBFCMaxConnectionsToServer", 1) + $testparams.add("DDBFCRequestTimeout", 3000) + $testparams.add("DDBFCChannelOpenTimeOut", 3000) + $testparams.add("DEHCMaxConnectionsToServer", 1) + $testparams.add("DEHCRequestTimeout", 3000) + $testparams.add("DEHCChannelOpenTimeOut", 3000) + $testparams.add("DFSPTCMaxConnectionsToServer", 1) + $testparams.add("DFSPTCRequestTimeout", 3000) + $testparams.add("DFSPTCChannelOpenTimeOut", 3000) + $testparams.add("DSPABSCMaxConnectionsToServer", 1) + $testparams.add("DSPABSCRequestTimeout", 3000) + $testparams.add("DSPABSCChannelOpenTimeOut", 3000) + $testparams.add("DSPCVCMaxConnectionsToServer", 1) + $testparams.add("DSPCVCRequestTimeout", 3000) + $testparams.add("DSPCVCChannelOpenTimeOut", 3000) + $testparams.add("DSPOATCMaxConnectionsToServer", 1) + $testparams.add("DSPOATCRequestTimeout", 3000) + $testparams.add("DSPOATCChannelOpenTimeOut", 3000) + $testparams.add("DSGCMaxConnectionsToServer", 1) + $testparams.add("DSGCRequestTimeout", 3000) + $testparams.add("DSGCChannelOpenTimeOut", 3000) + $testparams.add("DUACMaxConnectionsToServer", 1) + $testparams.add("DUACRequestTimeout", 3000) + $testparams.add("DUACChannelOpenTimeOut", 3000) + $testparams.add("DUAuCMaxConnectionsToServer", 1) + $testparams.add("DUAuCRequestTimeout", 3000) + $testparams.add("DUAuCChannelOpenTimeOut", 3000) + } } It "Should return DLTCMaxConnectionsToServer equals 5" { From 096edc9d600846b0f108b8b027ebf7ebdcd07a3e Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Tue, 25 Apr 2023 09:55:18 +0200 Subject: [PATCH 2/3] Corrected unit tests and updated changelog --- CHANGELOG.md | 5 ++ ...MSFT_SPDistributedCacheClientSettings.psm1 | 50 +++++++++++++++++++ ...SPDistributedCacheClientSettings.Tests.ps1 | 33 ++++++++++++ 3 files changed, 88 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f9765587..bad923b84 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] +### Added + +- SPDistributedCacheClientSettings + - Added additional parameters for SP2019 and SPSE + ### Changed - SPFarm diff --git a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 index 752f3116d..c15c97152 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 @@ -910,6 +910,56 @@ function Set-TargetResource } } + if ($PSBoundParameters.ContainsKey("DDBFCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DDBFCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DDBFCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DEHCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DEHCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DEHCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DFSPTCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DFSPTCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DFSPTCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DSPABSCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DSPABSCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DSPABSCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DSPCVCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DSPCVCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DSPCVCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DSPOATCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DSPOATCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DSPOATCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DSGCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DSGCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DSGCChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DUACMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DUACRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DUACChannelOpenTimeOut") -eq $true -or + $PSBoundParameters.ContainsKey("DUAuCMaxConnectionsToServer") -eq $true -or + $PSBoundParameters.ContainsKey("DUAuCRequestTimeout") -eq $true -or + $PSBoundParameters.ContainsKey("DUAuCChannelOpenTimeOut") -eq $true) + { + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.FileMajorPart -eq 15 -or ` + $installedVersion.ProductBuildPart.ToString().Length -eq 4) + { + $message = ("The following parameters are only supported in SharePoint 2019 and above: " + ` + "DDBFCMaxConnectionsToServer, DDBFCRequestTimeout, DDBFCChannelOpenTimeOut, " + ` + "DEHCMaxConnectionsToServer, DEHCRequestTimeout, DEHCChannelOpenTimeOut, " + ` + "DFSPTCMaxConnectionsToServer, DFSPTCRequestTimeout, DFSPTCChannelOpenTimeOut, " + ` + "DSPABSCMaxConnectionsToServer, DSPABSCRequestTimeout, DSPABSCChannelOpenTimeOut, " + ` + "DSPCVCMaxConnectionsToServer, DSPCVCRequestTimeout, DSPCVCChannelOpenTimeOut, " + ` + "DSPOATCMaxConnectionsToServer, DSPOATCRequestTimeout, DSPOATCChannelOpenTimeOut, " + ` + "DSGCMaxConnectionsToServer, DSGCRequestTimeout, DSGCChannelOpenTimeOut, " + ` + "DUACMaxConnectionsToServer, DUACRequestTimeout, DUACChannelOpenTimeOut, " + ` + "DUAuCMaxConnectionsToServer, DUAuCRequestTimeout, DUAuCChannelOpenTimeOut") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 index 0e11e1fb5..60bfffc0e 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 @@ -329,6 +329,39 @@ try } } } + + if ($Global:SPDscHelper.CurrentStubBuildNumber.Build.ToString().Length -lt 5) + { + Context -Name "SP2019+ parameters specified with older versions" -Fixture { + BeforeAll { + Mock -CommandName Get-SPDistributedCacheClientSetting -MockWith { + return @{ + MaxConnectionsToServer = 1 + RequestTimeout = 3000 + ChannelOpenTimeOut = 3000 + } + } + $testParams = @{ + IsSingleInstance = "Yes" + DUAuCMaxConnectionsToServer = 1 + DUAuCRequestTimeout = 3000 + DUAuCChannelOpenTimeOut = 3000 + } + } + + It "Should throw exception in the Get method" { + { Get-TargetResource @testParams } | Should -Throw "The following parameters are only supported in SharePoint 2019 and above" + } + + It "Should throw exception in the Set method" { + { Set-TargetResource @testParams } | Should -Throw "The following parameters are only supported in SharePoint 2019 and above" + } + + It "Should throw exception in the Test method" { + { Test-TargetResource @testParams } | Should -Throw "The following parameters are only supported in SharePoint 2019 and above" + } + } + } } } } From 9defeeaa62ce104a2f816bc94285e34b6f3598aa Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Tue, 25 Apr 2023 10:03:23 +0200 Subject: [PATCH 3/3] Adding example --- .../3-ConfigureClientSettings 2019.ps1 | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/3-ConfigureClientSettings 2019.ps1 diff --git a/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/3-ConfigureClientSettings 2019.ps1 b/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/3-ConfigureClientSettings 2019.ps1 new file mode 100644 index 000000000..638f9d467 --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/3-ConfigureClientSettings 2019.ps1 @@ -0,0 +1,134 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example configures the distributed cache client settings + in SharePoint 2019. + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPDistributedCacheClientSettings Settings + { + IsSingleInstance = "Yes" + DLTCMaxConnectionsToServer = 3 + DLTCRequestTimeout = 1000 + DLTCChannelOpenTimeOut = 1000 + DVSCMaxConnectionsToServer = 3 + DVSCRequestTimeout = 1000 + DVSCChannelOpenTimeOut = 1000 + DACMaxConnectionsToServer = 3 + DACRequestTimeout = 1000 + DACChannelOpenTimeOut = 1000 + DAFMaxConnectionsToServer = 3 + DAFRequestTimeout = 1000 + DAFChannelOpenTimeOut = 1000 + DAFCMaxConnectionsToServer = 3 + DAFCRequestTimeout = 1000 + DAFCChannelOpenTimeOut = 1000 + DBCMaxConnectionsToServer = 3 + DBCRequestTimeout = 1000 + DBCChannelOpenTimeOut = 1000 + DDCMaxConnectionsToServer = 3 + DDCRequestTimeout = 1000 + DDCChannelOpenTimeOut = 1000 + DSCMaxConnectionsToServer = 3 + DSCRequestTimeout = 1000 + DSCChannelOpenTimeOut = 1000 + DTCMaxConnectionsToServer = 3 + DTCRequestTimeout = 1000 + DTCChannelOpenTimeOut = 1000 + DSTACMaxConnectionsToServer = 3 + DSTACRequestTimeout = 1000 + DSTACChannelOpenTimeOut = 1000 + DFLTCMaxConnectionsToServer = 3 + DFLTCRequestTimeout = 1000 + DFLTCChannelOpenTimeOut = 1000 + DSWUCMaxConnectionsToServer = 3 + DSWUCRequestTimeout = 1000 + DSWUCChannelOpenTimeOut = 1000 + DUGCMaxConnectionsToServer = 3 + DUGCRequestTimeout = 1000 + DUGCChannelOpenTimeOut = 1000 + DRTCMaxConnectionsToServer = 3 + DRTCRequestTimeout = 1000 + DRTCChannelOpenTimeOut = 1000 + DHSCMaxConnectionsToServer = 3 + DHSCRequestTimeout = 1000 + DHSCChannelOpenTimeOut = 1000 + DDBFCMaxConnectionsToServer = 1 + DDBFCRequestTimeout = 3000 + DDBFCChannelOpenTimeOut = 3000 + DEHCMaxConnectionsToServer = 1 + DEHCRequestTimeout = 3000 + DEHCChannelOpenTimeOut = 3000 + DFSPTCMaxConnectionsToServer = 1 + DFSPTCRequestTimeout = 3000 + DFSPTCChannelOpenTimeOut = 3000 + DSPABSCMaxConnectionsToServer = 1 + DSPABSCRequestTimeout = 3000 + DSPABSCChannelOpenTimeOut = 3000 + DSPCVCMaxConnectionsToServer = 1 + DSPCVCRequestTimeout = 3000 + DSPCVCChannelOpenTimeOut = 3000 + DSPOATCMaxConnectionsToServer = 1 + DSPOATCRequestTimeout = 3000 + DSPOATCChannelOpenTimeOut = 3000 + DSGCMaxConnectionsToServer = 1 + DSGCRequestTimeout = 3000 + DSGCChannelOpenTimeOut = 3000 + DUACMaxConnectionsToServer = 1 + DUACRequestTimeout = 3000 + DUACChannelOpenTimeOut = 3000 + DUAuCMaxConnectionsToServer = 1 + DUAuCRequestTimeout = 3000 + DUAuCChannelOpenTimeOut = 3000 + PsDscRunAscredential = $SetupAccount + } + } +}