From 50ff653b7585689ecc153457705ca2dea1a9f3f3 Mon Sep 17 00:00:00 2001 From: Marko Bozikovic Date: Wed, 24 May 2017 15:20:13 +0100 Subject: [PATCH] [#569] A fix for SQL 2016 virtual directory name change. --- CHANGELOG.md | 1 + .../MSFT_xSQLServerRSConfig.psm1 | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8266d6d570..adba18390c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ - Changes to xSQLServerRSConfig - Replaced sqlcmd.exe usages with Invoke-Sqlcmd calls (issue #567). - BREAKING CHANGE: removed $SQLAdminCredential parameter. Use common parameter PsDscRunAsCredential (WMF 5.0+) to run the resource under different credentials. PsDscRunAsCredential Windows account must be a sysadmin on SQL Server (issue #568). + - fixed virtual directory creation for SQL Server 2016 ## 7.0.0.0 diff --git a/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.psm1 b/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.psm1 index 905c55ecce..4e6b0ed472 100644 --- a/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.psm1 +++ b/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.psm1 @@ -113,8 +113,11 @@ function Set-TargetResource } if($RSConfig.VirtualDirectoryReportManager -ne $RMVirtualDirectory) { - $null = $RSConfig.SetVirtualDirectory("ReportManager",$RMVirtualDirectory,$Language) - $null = $RSConfig.ReserveURL("ReportManager","http://+:80",$Language) + # SSRS Web Portal application name changed in SQL Server 2016 + # https://docs.microsoft.com/en-us/sql/reporting-services/breaking-changes-in-sql-server-reporting-services-in-sql-server-2016 + $virtualDirectoryName = if ($SQLVersion -ge 13) { 'ReportServerWebApp' } else { 'ReportManager'} + $null = $RSConfig.SetVirtualDirectory($virtualDirectoryName,$RMVirtualDirectory,$Language) + $null = $RSConfig.ReserveURL($virtualDirectoryName,"http://+:80",$Language) } $RSCreateScript = $RSConfig.GenerateDatabaseCreationScript($RSDatabase,$Language,$false) @@ -124,8 +127,8 @@ function Set-TargetResource Invoke-Sqlcmd -ServerInstance $RSConnection -Query $RSCreateScript.Script Invoke-Sqlcmd -ServerInstance $RSConnection -Query $RSRightsScript.Script - $RSConfig.SetDatabaseConnection($RSConnection,$RSDatabase,2,"","") - $RSConfig.InitializeReportServer($RSConfig.InstallationID) + $null = $RSConfig.SetDatabaseConnection($RSConnection,$RSDatabase,2,"","") + $null = $RSConfig.InitializeReportServer($RSConfig.InstallationID) } if(!(Test-TargetResource @PSBoundParameters))