This project is read-only.

Script Samples (Reporting Services)

11/05/2008 21:36:06

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
AddItemSecurity.rss Demonstrates how to use a script to set item security policies in the report server namespace.
CancelRunningJobs.rss Demonstrates a sample administration script that cancels jobs that are running on a report server.
ConfigureSystemProperties.rss Demonstrates a script that can be used to set system-level, report server properties.
PublishSampleReports.rss 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 -? * Note: 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 Assistance* © 2008 Microsoft Corporation. All rights reserved.

Last edited Nov 6, 2008 at 11:11 PM by bonniefe, version 9


janosch Jul 16, 2014 at 10:11 AM 
it seems that any script samples have not been included in the msi Installation file. What happened to them?

kirtan May 21, 2011 at 6:31 AM 
Cancel A Specific SSRS Job

Add User To SSRS Reports In A Folder

senloe Nov 30, 2010 at 6:35 PM 
the script samples are not installed with this download. Boo.

Kavajo Sep 28, 2010 at 1:29 PM 
Where are the 2008 script samples?

zart Jul 17, 2010 at 12:38 AM 
if the script samples are not available in this download package, then it should state so on this page.

mariwill Jul 9, 2010 at 10:52 PM 
The script sample are available in the download package of SQL Server 2005 Reporting Services samples and the download package of SQL Server 2008 Reporting Services samples. They are not available in a SQL Server 2008 R2 version. For more information about downloads of specific versions of samples, go to

atacoronte Jul 1, 2010 at 1:06 PM 
According to the title of this page "Script Sample (Reporting Service)", you should find them after you download the msi file (in my case x64) and install the Reporting Service samples in the following path C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Script Samples. I already installed and uninstalled several times and always the only two folder under Reporting Services folder that I have got are "Model Samples" and "Report Samples". Is there a way to get the four script sample files referenced at the top of this page?

carolrenna Apr 15, 2010 at 4:06 PM 
The script for creating reports on the Report server - PublishSampleReports.rss - does not work on SQL Server 2008 - the bye stream has to be defined a byte smaller or the CreateReport function does not work - seems to read an extra character. The following worked:

Console.WriteLine("Reading in report {0}", reportName)
Dim stream As FileStream = File.OpenRead(filePath + reportName + ".rdl")
definition = New [Byte](stream.Length - 1) {}
stream.Read(definition, 0, CInt(stream.Length))