From 66a470ee84257711d6e083680d1106d9eb331fe2 Mon Sep 17 00:00:00 2001 From: Marko Bozikovic Date: Mon, 31 Dec 2018 14:41:41 +0100 Subject: [PATCH] [#864] SSRS 2017 username, service instance names --- DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1 | 28 +++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1 b/DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1 index 227dfa0406..7f69a6aa7d 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 } }