How To Deploy a Folder of RDL files Using RS.exe – SSRS

It is relatively straightforward to automatically deploy a locally stored folder of RDL files to a reporting server without having to manually upload each one.

To do this we need to create two files.

  • .bat file to set off RS.exe
  • .rss file that holds the scripting information that is required

Create a folder on the c drive of your SSRS folder called DBAFire or similar.

In that folder take the text from below and put into a .bat file.

@echo off 
::Script Variables 
SET LOGFILE="C:\DBAFire\RS Scripter log.txt" 
SET REPORTSERVER=http://localhost/ReportServer 
::Clear Log file 
IF EXIST %logfile% DEL %logfile% 
::Run Scripts
 %rs% -i "C:\DBAFire\SSRSDeploy.rss" -s "%REPORTSERVER%" 
ECHO Finished Load at TE% %TIME% >>%LOGFILE% 

Now you need two more things.

The folder of your RDL files. Put that also inside the folder you have created and call it “RDLs”

And you need the rss script. This is a basically a VB script that the RS.exe uses.

Create the script from the below code and call it SSRSDeploy.rss

' Simplified and adapted from the MS sample script that can be found at 
' This version will dynamically upload from a folder, rather than hardcoded rdl files names. 
Dim definition As [Byte]() = Nothing 
Dim warnings As Warning() = Nothing 
Dim parentFolder As String = "FolderName to Upload to" 
Dim parentPath As String = "/" + parentFolder 
Dim filePath As String = "C:\DBAFire\RDLs\" 
Dim fileName As String 

Public Sub Main() 
rs.Credentials = System.Net.CredentialCache.DefaultCredentials 

'Create the parent folder 

	Try rs.CreateFolder(parentFolder, "/", Nothing) 

		Console.WriteLine("Parent folder {0} created successfully", parentFolder) 

		Catch e As Exception 
	End Try 

'Process the list of files found in the directory. 
Console.WriteLine("Getting Paths") 

Dim fileEntries As String() = System.IO.Directory.GetFiles(filePath) 
Dim fileName As String 

	For Each fileName In fileEntries 	
			fileName = filename.replace(".rdl", "") 
			FileName = filename.replace(filePath,"") 
				Console.WriteLine("Trying to deploy " & filename) 
	Next fileName 
End Sub 

Public Sub PublishReport(ByVal reportName As String) 

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

	Catch e As IOException 

End Try 

warnings = rs.CreateReport(reportName, parentPath, False, definition, Nothing) 

	If Not (warnings Is Nothing) 
		Dim warning As Warning 
		For Each warning In warnings 

	Next warning 

Else Console.WriteLine("Report: {0} published successfully with no warnings", reportName) 


If Catch e As Exception Console.WriteLine(e.Message) 
End Try 
End Sub

Now to run you need to fill your RDLs folder up with the reports that you wish to upload.

Then fill out the variables. Mainly the Folder name to upload to in the .rss file.

You will also need to change the filepaths in both folders if you didn’t stick to c:\dbafire.

When you run the batch file make sure you run as Administrator.


Expert Tip: Make sure your datasources are setup first if you are doing a migration. That will help things run smoothly first up.

If you have any questions feel free to ask.

Rob StGeorge
Senior SQL Server Database Administrator residing in Auckland, NZ


  1. Hi, I am using a custom datasource for my reports so that I can prompt the user for the server name and database name. This allows for one report that will work on many databases. Problem is, when I upload the RDL through the RS utility, it does not contain the user name and password for the servers (same for all). I dont want to have to upload dozens of reports and then have to configure them all manually. Is there a way of uploading the credentials automatically?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.