From 0a7ed12a5d6f5e53da50af92b8766f8e5d4ebac3 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 29 Aug 2021 09:21:16 +0200 Subject: [PATCH] Fix from PR #1698 --- CHANGELOG.md | 2 ++ source/DSCResources/DSC_SqlRS/DSC_SqlRS.psm1 | 24 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3a956ee7..0261ec8ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed integration tests for SQL Server 2016 and SQL Server 2017. - SqlServerDsc.Common - Fixed so that _CredScan_ no longer reports a password false-positive ([issue #1712](https://github.com/dsccommunity/SqlServerDsc/issues/1712)). +- SqlRS + - Fixed SSRS 2019 initialisation [issue #1509](https://github.com/dsccommunity/SqlServerDsc/issues/1509). ## [15.1.1] - 2021-02-12 diff --git a/source/DSCResources/DSC_SqlRS/DSC_SqlRS.psm1 b/source/DSCResources/DSC_SqlRS/DSC_SqlRS.psm1 index fa7183d1a..d0744df85 100644 --- a/source/DSCResources/DSC_SqlRS/DSC_SqlRS.psm1 +++ b/source/DSCResources/DSC_SqlRS/DSC_SqlRS.psm1 @@ -160,7 +160,7 @@ function Get-TargetResource .PARAMETER SuppressRestart Reporting Services need to be restarted after initialization or settings change. If this parameter is set to $true, Reporting Services - will not be restarted, even after initialisation. + will not be restarted, even after initialization. .NOTES To find out the parameter names for the methods in the class @@ -463,6 +463,23 @@ function Set-TargetResource Invoke-RsCimMethod @invokeRsCimMethodParameters + <# + When initializing SSRS 2019, the call to InitializeReportServer + always fails, even if IsInitialized flag is $false. + It also seems that simply restarting SSRS at this point initializes + it. + + We will ignore $SuppressRestart here. + #> + if ($reportingServicesData.SqlVersion -ge 15) + { + Write-Verbose -Message $script:localizedData.Restart + + Restart-ReportingServicesService -InstanceName $InstanceName -WaitTime 30 + + $restartReportingService = $false + } + $reportingServicesData = Get-ReportingServicesData -InstanceName $InstanceName <# @@ -473,6 +490,8 @@ function Set-TargetResource #> if ( -not $reportingServicesData.Configuration.IsInitialized ) { + $restartReportingService = $true + $invokeRsCimMethodParameters = @{ CimInstance = $reportingServicesData.Configuration MethodName = 'InitializeReportServer' @@ -488,6 +507,8 @@ function Set-TargetResource { Write-Verbose -Message "Changing value for using SSL to '$UseSsl'." + $restartReportingService = $true + $invokeRsCimMethodParameters = @{ CimInstance = $reportingServicesData.Configuration MethodName = 'SetSecureConnectionLevel' @@ -1012,4 +1033,3 @@ function Invoke-RsCimMethod return $invokeCimMethodResult } -