Export (0) Print
Expand All

Scripting Deployment and Administrative Tasks

Updated: 12 December 2006

Reporting Services supports the use of scripts to automate routine installation, deployment, and administrative tasks. Deploying a report server is a multi-step process. You must use several tools and processes to configure a deployment; there is no single program or approach that can be used to automate all of the tasks.

Not every step should be automated. In some cases, performing a step manually or through a graphical tool is the simplest and most effective approach. For example, if you want to deploy a large number of reports and models, it is better to copy the report server databases rather than write code that recreates report server content.

Some steps require custom code. For example, configuring the virtual directories and Web service can be automated, but only if you write custom code that makes calls into the Report Server Windows Management Instrumentation (WMI) provider. If you do not want to write code, you must use the Reporting Services Configuration tool to perform the step.

To run script that configures a report server, you must be a local administrator on the computer that you are configuring. For more information, see Configuring a Report Server for Remote Administration.

This topic describes recommended approaches for automating specific steps. Several programs and programmatic interfaces are mentioned; descriptions of each one are provided further on in this topic.

The following table summarizes all of the installation and configuration tasks that are necessary for deploying a report server. You can use the table to match a specific task to an approach that allows you to automate or perform the task unattended.

Task Approach

Install Reporting Services.

You can run setup from the command line to perform an unattended installation.

You can use Setup to both install and configure a report server, but only if you choose the default configuration option and your system meets all of the requirements for this installation type. If you cannot install the default configuration, you must perform a files-only installation. For more information about installation options, see Installing Reporting Services Using Setup.

Configure a Web site in Internet Information Services (IIS).

Reporting Services provides no facilities for creating or configuring a Web site. Consult IIS product documentation for more information about automating this task.

Configure the Report Server Web service and virtual directories.

You must write custom code that makes calls into the Report Server WMI provider. There are no command line utilities or script templates for configuring the Web service and specifying virtual directories.

If coding requirements prevent you from automating this step, you can easily configure the Web service and virtual directories manually by running the Reporting Services Configuration tool. For more information, see Configuring Report Server Virtual Directories.

Create, upgrade, or configure the report server database.

Choose from the following approaches to automate database configuration:

  • Create the scripts GenerateNewDatabaseScript.sql, UpgradeDatabaseScript.sql, or GrantRightsScript.sql from predefined script templates. You can generate these scripts from the Reporting Services Configuration tool or by calling the Windows Management Instrumentation (WMI) provider. You can run the scripts programmatically from a command line by using the osql utility or from a query window in Management Studio.
  • Run the rsconfig utility to configure the connection. You cannot use rsconfig.exe to create or upgrade the database. If you use rsconfig, be sure to run the GrantRightsScript to grant permission to the report server database. You must regenerate and run the script for each service account. The number of times you regenerate and run the script depends on how you configured the report server database connection. Because there are two service accounts, you must regenerate and run the scripts twice.

Configure a scale-out deployment.

Choose from the following approaches to automate scale-out deployment:

Backup encryption keys.

Choose from the following approaches to automate encryption key backup:

Configure Report Server E-mail.

Write custom code that runs against the Reporting Services WMI provider. The provider supports a subset of the e-mail configuration settings.

Although the RSReportServer.config file includes all the settings, do not use the file in an automated manner. Specifically, do not use a batch file to copy the file to another report server. Each configuration file includes values that are specific to the current instance. Those values will not be valid on other report server instances.

For more information about the settings, see Configuring a Report Server for E-Mail Delivery.

Configure the unattended execution account.

Choose from the following approaches to automate unattended processing account configuration:

Deploy an existing report server environment, including the folder hierarchy, role assignments, reports, subscriptions, schedules, data sources, and resources.

The best way to recreate an existing report server environment is to copy the report server database to a new report server instance.

An alternate approach is to write custom code that recreates existing report server content programmatically. However, be aware that subscriptions, report snapshots, and report history cannot be recreated programmatically.

Some deployments can benefit from using both techniques together (that is, restore a report server database, and then run custom code that modifies the report server database for a specific installation).

For more information about relocating a report server database, see Moving a Report Server Database to Another Computer. For more information about creating report serer environment programmatically, see the section "Duplicating a Report Server Environment" in this topic.

The following list summarizes the programs and interfaces that can be used to automate deployment and maintenance tasks:

  • The Setup program can be run in unattended mode to install and sometimes configure report server components. You must choose Files-Only installation option to have Setup configure a report server instance.
  • The Report Server WMI provider and Reporting Services command line utilities can be used for local and remote server configuration.
    The Report Server WMI provider exposes classes, properties, and methods that allow you to configure all aspects of a Reporting Services installation including specifying service accounts, configuring virtual directories, creating and configuring the report server database, or configuring a report server for e-mail delivery. You must write custom code or script to use the WMI provider. For more information, see Reporting Services WMI Provider.
    An alternative to writing code is to use the command line utilities (rsconfig.exe and rskeymgmt.exe). You can write batch files that run the utilities. You can use the utilities to automate some but not all configuration tasks.
  • Script templates allow you to generate ready-to-use scripts for creating, upgrading, and configuring the report server database. You can generate scripts from the Reporting Services Configuration tool.
  • The report server script host tool (rs.exe) can run custom Visual Basic code that you might write to re-create or move existing content from one report server to another. With this approach, you write script in Visual Basic, save it as an .rss file, and use rs.exe to run the script on the target report server. The script you write can call the SOAP interface to the Report Server Web service. Deployment scripts are written using this approach because it allows you to re-create a report server folder namespace and content, and re-create role-based security.
    You can also use rs.exe to run custom or generated script that you create in SQL Server Management Studio. For Reporting Services, the script generation feature in Management Studio creates Visual Basic code for a very specific task (for example, creating a role, setting report properties, defining a schedule, and so on). The generated code is incomplete; it captures keyboard strokes and mouse events. To use this code, you must copy it into a larger program that you create.
ms159720.note(en-US,SQL.90).gifNote:
In contrast with previous releases of Reporting Services, you can no longer use Setup to deploy all possible report server configurations. If you want to configure a scale-out deployment or use a remote SQL Server instance to host the report server database, you must write script or run a command line utility. In addition, the Report Server WMI provider has been updated in SQL Server 2005. If you want to reuse scripts that you wrote against the previous release of the WMI provider, you must modify the scripts to use the new endpoint.

You can write scripts that duplicate a report server environment on another report server instance. Deployment scripts are generally written in Visual Basic and then processed using the report server script host utility.

Use scripts to copy folders, shared data sources, resources, reports, role assignments, and settings from one server to another. You write a script for one report server instance, and then run it on another server to re-create the report server namespace. If you have multiple report servers in your reporting services deployment, you can run the script on each server individually to configure all servers in the same way.

The following list describes the steps for migrating reports from one server to another.

  1. Set your script variable to the URL of the source report server.
  2. Use the GetReportDefinition method and GetProperties method to retrieve the report definition and the properties of the report.
  3. Set the URL to point to the destination server.
  4. Use CreateReport method, passing the properties returned from GetProperties and the report definition returned by GetReportDefinition.

By using a combination of get and create methods, you can perform similar steps to migrate settings, folders, shared data sources, and resources. For more information about the methods available to you, see Reporting Services Managed Programming Reference.

ms159720.note(en-US,SQL.90).gifNote:
Scripts run under the Microsoft Windows credentials of the user running the script unless credentials are explicitly set.

For more information about script samples, see Script Samples (Reporting Services). For more information about how to format and run a script file, see Scripting with the rs Utility and the Web Service.

You can write script or code that sets system properties on the report server. The following Microsoft Visual Basic .NET script shows one way to set properties. This example disables the RSClientPrint ActiveX control, but you can replace EnableClientPrinting and False with any valid property name and value. To view a complete list of server properties, see Report Server System Properties.

To use the script, save it to a file that has an .rss extension, and then use the rs.exe command prompt utility to run the file on the report server. The script is not compiled, so it is not necessary to have an installation of Visual Basic. This example assumes you have permissions on the local computer that hosts the report server. If you are not logged on under an account that has permissions, you must specify account information through additional command line arguments. For more information, see rs Utility.

Public Sub Main()
        Dim props(0) As [Property]
        Dim setProp As New [Property]
        setProp.Name = "EnableClientPrinting"
        setProp.Value = “False” 
        props(0) = setProp
        Try
            rs.SetSystemProperties(props)
        Catch ex As System.Web.Services.Protocols.SoapException
            Console.Write(ex.Detail.InnerXml)
        Catch e as Exception
            Console.Write(e.Message)
        End Try
End Sub

Release History

12 December 2006

Changed content:
  • Create, upgrade, or configure the report server database.
  • Configuring report server e-mail.

17 July 2006

New content:
  • Added an example of how to set server properties through script.

14 April 2006

Changed content:
  • Significant revision.

Community Additions

ADD
Show:
© 2014 Microsoft