diff --git a/DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1 b/DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1 index 227dfa040..7f69a6aa7 100644 --- a/DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1 +++ b/DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1 @@ -226,7 +226,23 @@ function Set-TargetResource if ( $null -ne $reportingServicesData.Configuration ) { - if ( $InstanceName -eq 'MSSQLSERVER' ) + if ( $reportingServicesData.SqlVersion -ge 14 ) + { + if ( [string]::IsNullOrEmpty($ReportServerVirtualDirectory) ) + { + $ReportServerVirtualDirectory = 'ReportServer' + } + + if ( [string]::IsNullOrEmpty($ReportsVirtualDirectory) ) + { + $ReportsVirtualDirectory = 'Reports' + } + + $reportingServicesServiceName = 'SQLServerReportingServices' + $reportingServicesDatabaseName = 'ReportServer' + + } + elseif ( $InstanceName -eq 'MSSQLSERVER' ) { if ( [System.String]::IsNullOrEmpty($ReportServerVirtualDirectory) ) { @@ -823,7 +839,14 @@ function Get-ReportingServicesData if ( Get-ItemProperty -Path $instanceNamesRegistryKey -Name $InstanceName -ErrorAction SilentlyContinue ) { $instanceId = (Get-ItemProperty -Path $instanceNamesRegistryKey -Name $InstanceName).$InstanceName - $sqlVersion = [System.Int32]((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\Setup" -Name 'Version').Version).Split('.')[0] + + $sqlVersion = if(Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\MSSQLServer\CurrentVersion") { + # SQL Server 2017 SSRS stores current SQL Server version to a different Registry path. + [int]((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$InstanceId\MSSQLServer\CurrentVersion" -Name "CurrentVersion").CurrentVersion).Split(".")[0] + } + else { + [int]((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\Setup" -Name "Version").Version).Split(".")[0] + } $reportingServicesConfiguration = Get-CimInstance -ClassName MSReportServer_ConfigurationSetting -Namespace "root\Microsoft\SQLServer\ReportServer\RS_$InstanceName\v$sqlVersion\Admin" $reportingServicesConfiguration = $reportingServicesConfiguration | Where-Object -FilterScript { $_.InstanceName -eq $InstanceName @@ -846,6 +869,7 @@ function Get-ReportingServicesData @{ Configuration = $reportingServicesConfiguration ReportsApplicationName = $reportsApplicationName + SqlVersion = $sqlVersion } }