diff --git a/CHANGELOG.md b/CHANGELOG.md index e95691e1c..126995074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- SPSearchCrawlerImpactRule + - Resource threw an error on the Set-TargetResource Function because the `SPEnterpriseSearchSiteHitRule` + cmdlet Parameter `SearchService` does not support a Search Service Application Object. + ## [5.6.0] - 2025-01-23 ### Fixed @@ -14,12 +20,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SPSite - The Get Method failed to get an existing Site Collection on SharePoint Server Subscription Edition - - - SPSearchCrawlerImpactRule - - Ressource threw an error if the Crawler Impact Rule did not exist when + - Resource threw an error if the Crawler Impact Rule did not exist when running the Get Method + ## [5.5.0] - 2024-04-22 ### Added diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 index 8e391d29e..237a44f08 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 @@ -157,7 +157,7 @@ function Set-TargetResource $hitRate = $params.RequestLimit } - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName + $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName | Select-Object -ExpandProperty DisplayName if ($null -eq $serviceApp) { $message = "The Search Service Application does not exist." @@ -193,7 +193,7 @@ function Set-TargetResource $behavior = "0" $hitRate = $params.RequestLimit } - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName + $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName | Select-Object -ExpandProperty DisplayName if ($null -eq $serviceApp) { $message = "The Search Service Application does not exist." @@ -223,7 +223,7 @@ function Set-TargetResource $params = $args[0] $eventSource = $args[1] - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName + $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName | Select-Object -ExpandProperty DisplayName if ($null -eq $serviceApp) { $message = "The Search Service Application does not exist." diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlerImpactRule.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlerImpactRule.Tests.ps1 index 4d39b8a15..3559d8e3b 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlerImpactRule.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlerImpactRule.Tests.ps1 @@ -49,7 +49,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 # Initialize tests $getTypeFullName = "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" @@ -107,7 +107,7 @@ try } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return [pscustomobject]@{ DisplayName = $testParams.ServiceAppName } } @@ -141,7 +141,7 @@ try } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return [pscustomobject]@{ DisplayName = $testParams.ServiceAppName } } @@ -179,7 +179,7 @@ try } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return [pscustomobject]@{ DisplayName = $testParams.ServiceAppName } } @@ -207,7 +207,7 @@ try } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return [pscustomobject]@{ DisplayName = $testParams.ServiceAppName } } @@ -287,7 +287,7 @@ try } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return [pscustomobject]@{ DisplayName = $testParams.ServiceAppName } } @@ -321,7 +321,7 @@ try } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return [pscustomobject]@{ DisplayName = $testParams.ServiceAppName } }