Skip to content

Request‑SqlDscRSDatabaseScript

dscbot edited this page Jan 5, 2026 · 1 revision

SYNOPSIS

Generates the T-SQL script to create a report server database.

SYNTAX

Request-SqlDscRSDatabaseScript [-Configuration] <Object> [-DatabaseName] <String> [[-Lcid] <Int32>]
 [<CommonParameters>]

DESCRIPTION

Generates the T-SQL script to create a report server database for SQL Server Reporting Services or Power BI Report Server by calling the GenerateDatabaseCreationScript method on the MSReportServer_ConfigurationSetting CIM instance.

The generated script can be executed on a SQL Server Database Engine instance using Invoke-SqlDscQuery to create the report server database.

The configuration CIM instance can be obtained using the Get-SqlDscRSConfiguration command and passed via the pipeline.

The Reporting Services service must be running before calling this command. For SQL Server Reporting Services the service name is SQLServerReportingServices, and for Power BI Report Server the service name is PowerBIReportServer. If the service is not running, a terminating error is thrown.

EXAMPLES

EXAMPLE 1

Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Request-SqlDscRSDatabaseScript -DatabaseName 'ReportServer'

Generates the T-SQL script to create the 'ReportServer' database for the 'SSRS' Reporting Services instance.

EXAMPLE 2

$config = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
$script = $config | Request-SqlDscRSDatabaseScript -DatabaseName 'ReportServer'
Invoke-SqlDscQuery -ServerName 'localhost' -InstanceName 'RSDB' -DatabaseName 'master' -Query $script -Force

Generates the database creation script and executes it on the RSDB SQL Server instance to create the report server database.

PARAMETERS

-Configuration

Specifies the MSReportServer_ConfigurationSetting CIM instance for the Reporting Services instance. This can be obtained using the Get-SqlDscRSConfiguration command. This parameter accepts pipeline input.

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-DatabaseName

Specifies the name of the report server database to create. Common names are 'ReportServer' or 'ReportServer$InstanceName'.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Lcid

Specifies the Language Code ID (LCID) to use for the database collation. If not specified, defaults to the operating system language.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.Management.Infrastructure.CimInstance

Accepts MSReportServer_ConfigurationSetting CIM instance via pipeline.

OUTPUTS

System.String

Returns the T-SQL script as a string.

NOTES

After creating the database, use Request-SqlDscRSDatabaseRightsScript to generate the script that grants the necessary permissions, then use Set-SqlDscRSDatabaseConnection to configure the Reporting Services instance to use the new database.

RELATED LINKS

https://docs.microsoft.com/en-us/sql/reporting-services/wmi-provider-library-reference/configurationsetting-method-generatedatabasecreationscript

Home

Commands

How-to

Resources

Usage

Clone this wiki locally