Script Samples (Reporting Services)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

The following samples represent scripts written for Reporting Services using Microsoft Visual Basic .NET. Script samples typically address a single feature or technology and are task-based. You can use script files with the Reporting Services SOAP API to access most of the management and administration operations available on your report server.


Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator. Microsoft does not provide technical support for these samples.

The following table describes the sample scripts.

File Description


Demonstrates how to use a script to set item security policies in the report server namespace.


Demonstrates a sample administration script that cancels jobs that are running on a report server.


Demonstrates a script that can be used to set system-level, report server properties.


Demonstrates a script that publishes the sample reports to a report server.


Before you run sample scripts, the following conditions must be met:

  • The sample reports and the script files must first be installed to your hard drive using Reporting Services Setup or the separate sample installer.
  • You must have permission to run the rs utility from the computer on which a report server instance is installed.
  • You must have access to the report server that you are accessing with your script.
  • You must have appropriate permissions on the root folder of the report server you are accessing. For more information about permissions and user roles, see Granting Permissions on a Native Mode Report Server.

Location of the Script Files

When you install the samples to the default installation directory, scripting samples are located by default in C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Script Samples.


SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see Considerations for Installing SQL Server Samples and Sample Databases.

Running the Sample Scripts

You can run the sample scripts in the Reporting Services script environment.

To run this sample

  1. Open a command prompt: On the Start menu, click Run, type cmd in the text box, and then click OK.

  2. Navigate to the directory that contains your sample script. For example, if your sample script is installed in the default directory, type the following at the command prompt:

    cd C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Script Samples
  3. At the command prompt, enter the following to see a list of command prompt options available for use with the rs utility:

    rs -?


    If you receive a message that rs is not a recognized command or batch file, you may need to add the location of rs.exe to your Windows environment variable PATH.

  4. At the command prompt, type the appropriate command to run the sample script file. For example, to run PublishSampleReports.rss type the following command, while replacing the given server URL with the report server you are accessing:

    rs -i PublishSampleReports.rss -s http://<Server Name>/reportserver

Modifying the Script File

You can open any of the .rss files using a text editor.

See Also


Compiling and Running Code Examples
Reporting Services Samples

Other Resources

Scripting with the rs Utility and the Web Service
Application Samples (Reporting Services)
Accessing the SOAP API

Help and Information

Getting SQL Server 2008 R2 Assistance