Skip to content

Commit

Permalink
[dsccommunity#864] SSRS 2017 username, service instance names
Browse files Browse the repository at this point in the history
  • Loading branch information
bozho committed Dec 31, 2018
1 parent 457082c commit 66a470e
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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) )
{
Expand Down Expand Up @@ -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
Expand All @@ -846,6 +869,7 @@ function Get-ReportingServicesData
@{
Configuration = $reportingServicesConfiguration
ReportsApplicationName = $reportsApplicationName
SqlVersion = $sqlVersion
}
}

Expand Down

0 comments on commit 66a470e

Please sign in to comment.