Deploy reports by Reporting Service Utility

In production environment, we may not be able to deploy reports by click the “deploy” menu in the SSRS project or it may not be effective. Sometimes we may want to use batch to run the deployment, these batch will leverage the reporting service utility.

This exe file is located at SSRS server under …\Program Files\Microsoft SQL Server\100\Tools\Binn or
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn

You can put the following into a windows batch

RS syntax:
SET targetFolder=/MyReports
SET sourcePath=C:TempMyRDL
SET reportName=MyReport
rs.exe -i Deploy_rdl_file.rss -s http://MyServer/ReportServer
-v sourcePATH=”%sourcePath%”
-v targetFolder=”%targetFolder%”
-v reportName=”%reportName%”

RSS file (vbscript file)

Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Public Sub Main()
	Dim stream As FileStream = File.OpenRead(sourcePath + reportName + ".rdl")
	definition = New [Byte](stream.Length) {}
	stream.Read(definition, 0, CInt(stream.Length))
	warnings = rs.CreateReport(reportName, targetFolder, True, definition, Nothing)
	If Not (warnings Is Nothing) Then
		Dim warning As Warning
		For Each warning In warnings
		Next warning
		Console.WriteLine("Report: {0} published successfully with no warnings", reportName)
	End If
Catch e As IOException
End Try
End Sub

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s