RS.exe utility (SSRS)

The rs.exe utility processes script that you provide in an input file. Use this utility to automate report server deployment and administration tasks.

Note

Beginning with SQL Server 2008 R2 (10.50.x), the rs utility is supported against report servers that are configured for SharePoint integrated mode as well as servers configured in native mode. Previous versions only supported native mode configurations.

Syntax

  
rs {-?}  
{-i input_file}  
{-s serverURL}  
{-u username}  
{-p password}  
{-e endpoint}  
{-l time_out}  
{-b batchmode}  
{-v globalvars=}  
{-t trace}  

File location

RS.exe is located in the following folders, depending on the report server version. You can run the utility from any folder on your file system.

Applies to:  SQL Server Reporting Services (2016)

C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn  

Applies to:  SQL Server Reporting Services (2017 and later)

C:\Program Files\Microsoft SQL Server Reporting Services\Shared Tools

Applies to:  Power BI Report Server

C:\Program Files\Microsoft Power BI Report Server\Shared Tools

Arguments

-?
(Optional) Displays the syntax of rs arguments.

-i input_file
(Required) Specifies the .rss file to execute. This value can be a relative or fully qualified path to the .rss file.

-s serverURL
(Required) Specifies the Web server name and report server virtual directory name to execute the file against. An example of a report server URL is https://examplewebserver/reportserver. The prefix http:// or https:// at the beginning of the server name is optional. If you omit the prefix, the report server script host tries to use https first, and then uses http if https doesn't work.

-u [domain\]username
(Optional) Specifies a user account used to connect to the report server. If -u and -p are omitted, the current Windows user account is used.

-p password
(Required if -u is specified) Specifies the password to use with the -u argument. This value is case-sensitive.

-e
(Optional) Specifies the SOAP endpoint against which the script should run. Valid values are:

  • Mgmt2010

  • Mgmt2006

  • Mgmt2005

  • Exec2005

If a value isn't specified, the Mgmt2005 endpoint is used. For more information about the SOAP endpoints, see Report server web service endpoints.

-l time_out
(Optional) Specifies the number of seconds that elapse before the connection to the server times out. The default is 60 seconds. If you don't specify a time-out value, the default is used. A value of 0 specifies that the connection never times out.

-b
(Optional) Specifies that the commands in the script file run in a batch. If any commands fail, the batch is rolled back. Some commands can't be batched, and those commands run as usual. Only exceptions that are thrown and aren't handled within the script result in a rollback. If the script handles an exception and returns normally from Main, the batch is committed. If you omit this parameter, the commands run without creating a batch. For more information, see Batching methods.

-v globalvar
(Optional) Specifies global variables that are used in the script. If the script uses global variables, you must specify this argument. The value that you specify must be valid for global variable defined in the .rss file. You must specify one global variable for each -v argument.

The -v argument is specified on the command line and is used to set the value for a global variable that is defined in your script at run time. For example, if your script contains a variable named parentFolder, you can specify a name for that folder on the command line:

rs.exe -i myScriptFile.rss -s https://myServer/reportserver -v parentFolder="Financial Reports"

Global variables are created with the names given and set to the values supplied. For example, -v a="1" -v b="2" results in a variable named a with a value of"1" and a variable b with a value of "2".

Global variables are available to any function in the script. A backslash and quotation mark (\") is interpreted as a double quotation mark. The quotation marks are required only if the string contains a space. Variable names must be valid for Microsoft Visual Basic. They must start with alphabetical character or underscore and contain alphabetical characters, digits, or underscores. Reserved words can't be used as variable names. For more information about using global variables, see Built-in collections in expressions (Report Builder and SSRS).

-t
(Optional) Outputs error messages to the trace log. This argument doesn't take a value. For more information, see Report server service trace log.

Permissions

To run the tool, you must have permission to connect to the report server instance you're running the script against. You can run scripts to make changes to the local computer or a remote computer. To make changes to a report server installed on a remote computer, specify the remote computer in the -s argument.

Examples

The following example illustrates how to specify the script file that contains Visual Basic .NET script and Web service methods that you want to execute.

rs -i c:\scriptfiles\script_copycontent.rss -s https://localhost/reportserver  

For a detailed example, see Sample Reporting Services rs.exe script to copy content between report servers.

For more examples, see Run a Reporting Services script file

Remarks

You can define scripts to set system properties, publish reports, and so forth. The scripts that you create can include any methods of the Reporting Services API. For more information about the methods and properties available to you, see Report server web service.

The script must be written in Visual Basic .NET code, and stored in a Unicode or UTF-8 text file with an .rss file name extension. You can't debug scripts with the rs utility. To debug a script, run the code within Microsoft Visual Studio.