Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 自动配置SQL Server 2017 Reporting Services_Powershell_Reporting Services_Automation - Fatal编程技术网

Powershell 自动配置SQL Server 2017 Reporting Services

Powershell 自动配置SQL Server 2017 Reporting Services,powershell,reporting-services,automation,Powershell,Reporting Services,Automation,我正在尝试以静默方式安装和配置SQL Server 2017 Reporting Services。静默安装非常简单,我使用下面的PowerShell脚本完成了大部分配置 我遇到的问题是在尝试为报表管理器设置虚拟目录时。我在下面一行收到一个错误 $configset.SetVirtualDirectory("ReportManager", "Reports", 1033) HRESULT-2147220938:找不到应用程序 根据,似乎我正在以正确的顺序执行步骤 $configset = Ge

我正在尝试以静默方式安装和配置SQL Server 2017 Reporting Services。静默安装非常简单,我使用下面的PowerShell脚本完成了大部分配置

我遇到的问题是在尝试为报表管理器设置虚拟目录时。我在下面一行收到一个错误

$configset.SetVirtualDirectory("ReportManager", "Reports", 1033)
HRESULT-2147220938:找不到应用程序

根据,似乎我正在以正确的顺序执行步骤

$configset = Get-WmiObject –namespace "root\Microsoft\SqlServer\ReportServer\RS_SSRS\v14\Admin" `
    -class MSReportServer_ConfigurationSetting -ComputerName localhost

$configset

If (! $configset.IsInitialized)
{
    [string]$dbscript = $configset.GenerateDatabaseCreationScript("ReportServer", 1033, $false).Script

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
    Import-Module sqlps -DisableNameChecking | Out-Null

    $conn = New-Object Microsoft.SqlServer.Management.Common.ServerConnection -ArgumentList $env:ComputerName
    $conn.ApplicationName = "Script"
    $conn.StatementTimeout = 0
    $conn.Connect()
    $smo = New-Object Microsoft.SqlServer.Management.Smo.Server -ArgumentList $conn

    # Create the ReportServer and ReportServerTempDB databases
    $db = $smo.Databases["master"]
    $db.ExecuteNonQuery($dbscript)

    # Set permissions for the databases
    $dbscript = $configset.GenerateDatabaseRightsScript($configset.WindowsServiceIdentityConfigured, "ReportServer", $false, $true).Script
    $db.ExecuteNonQuery($dbscript)

    # Set the database connection info
    $configset.SetDatabaseConnection("(local)", "ReportServer", 2, "", "")

    $configset.SetVirtualDirectory("ReportServerWebService", "ReportServer", 1033)
    $configset.ReserveURL("ReportServerWebService", "http://+:80", 1033)

    $configset.SetVirtualDirectory("ReportManager", "Reports", 1033)
    $configset.ReserveURL("ReportManager", "http://+:80", 1033)

    $configset.InitializeReportServer($configset.InstallationID)

    $configset.IsReportManagerEnabled
    $configset.IsInitialized
    $configset.IsWebServiceEnabled
    $configset.IsWindowsServiceEnabled
    $configset.ListReportServersInDatabase()
    $configset.ListReservedUrls();

    $inst = Get-WmiObject –namespace "root\Microsoft\SqlServer\ReportServer\RS_SSRS\v14" `
        -class MSReportServer_Instance -ComputerName localhost

    $inst.GetReportServerUrls()
}

对这个问题的任何见解都将不胜感激

您可以使用DSC此链接应包含有关如何使用DSC资源的信息:

当这个代码是Xrev时,我能够使用当时称为MSFT_xSQLServerSetup的资源安装和配置SSR


下面是一个设置单个sql server的示例

问题在于SQL Server 2016及更高版本,报表管理器的web应用程序名称已从ReportManager更改为ReportServerWebApp。

谢谢。。。我检查了Reporting Services的DSC资源,在第515行中,该评论使我意识到在SQL 2016中,ReportManager应用程序的名称更改为ReportServerWebApp。我用完整的脚本创建了一个GitHub要点:很高兴您找到了解决方案。。。我在powershellposse.com上写了几篇关于SSRS报告自动化和订阅管理的文章。我在SSR2012中使用了它们,但在以后的版本中应该可以使用。