You can run a backup of all SSRS reports using the following script.
Assume you are using MSSQL 2019, locate the RS.exe Utility in below folder.
C:\Program Files\Microsoft SQL Server Reporting Services\Shared Tools
For older version, try look under below folder.
C:\Program Files\Microsoft SQL Server\150\Tools\Binn
Using Notepad, paste and save the following procedure as a "SSRS_Backup_Reports.rss". Sample file attached.
===============================================================================
Public Sub Main()
'--------------------------------------------------------------------------------------------------------------------
' Purpose: Script to backup reports from a folder on ReportServer
' Save file as .rss extension and run using rs.exe from command line.
' Reference: http://bhushan.extreme-advice.com/back-up-of-ssrs-reports-using-rs-utility/
' https://docs.microsoft.com/en-us/sql/reporting-services/tools/rs-exe-utility-ssrs?view=sql-server-2017
' Example: rs -s http://localhost/reportserver -i D:\Scripts\Backup_Reports.rss -e Mgmt2010 -v backupFolder="D:\Scripts\BackupReports" -v parentFolder="/IndividualReportFolderNameHere"
' rs -s http://localhost/reportserver -i D:\Scripts\Backup_Reports.rss -e Mgmt2010 -v backupFolder="D:\Scripts\BackupReports" -v parentFolder=""
'--------------------------------------------------------------------------------------------------------------------
Try
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim items As CatalogItem() = Nothing
If String.IsNullOrEmpty(parentFolder) Then
items = rs.ListChildren("/", True)
Else
items = rs.ListChildren(parentFolder, False)
End If
Console.WriteLine()
Console.WriteLine("...Backup Started...")
For Each item As CatalogItem In items
If item.TypeName = "Report" Then
Console.WriteLine(item.Path)
Dim reportPath As String = item.Path
parentFolder = Path.GetDirectoryName(item.Path) ' comment out this line to save the reports in one folder
Dim reportDefinition As Byte() = rs.GetItemDefinition(item.Path)
Dim rdlReport As New System.Xml.XmlDocument
Dim Stream As New MemoryStream(reportDefinition)
Dim backupPath As String = Path.Combine(backupFolder, Date.Now().ToString("yyyy.MM.dd") + "\" + parentFolder)
If (Not System.IO.Directory.Exists(backupPath)) Then
System.IO.Directory.CreateDirectory(backupPath)
End If
rdlReport.Load(Stream)
rdlReport.Save(Path.Combine(backupPath, item.Name + ".rdl"))
Console.WriteLine(item.Name + ".rdl")
End If
Next
Console.WriteLine("...Backup Completed...")
Console.WriteLine()
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
===============================================================================
Create below subfolders in C:
C:\Temp
C:\Temp\SSRS
C:\Temp\BackupReports
Save the "SSRS_Backup_Reports.rss" in folder C:\Temp\SSRS
Open DOS Command prompt with Run-as-Administrator.
Change folder to RS utility folder with below command:
cd C:\Program Files\Microsoft SQL Server Reporting Services\Shared Tools
Paste below into the DOS Command line.
rs -s http://[Server Name]/ReportServer -i C:\Temp\SSRS\SSRS_Backup_Reports.rss -e Mgmt2010 -v backupFolder="C:\Temp\SSRS\BackupReports" -v parentFolder=""
Note :
1) Please specify the correct parameter values in blue fonts.
2) Setting Parameter parentFolder="" means to save the entire folder structure with all the reports.
You can find a copy of the SSRS *.RDL file in below folder.
C:\Temp\BackupReports
More information regarding the RS Utility is available below.
SSRS RS.EXE Utility