Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By : Donabel Santos
Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By: Donabel Santos

Overview of this book

Table of Contents (21 chapters)
SQL Server 2014 with PowerShell v5 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Downloading all SSRS report RDL files


This recipe shows how you can download all RDL files from your Report Server.

Getting ready

In this recipe, we will download all RDL files from the SSRS Report Server into C:\SSRS\ in a subfolder structure that mimics the folder structure in the Report Server.

Identify your SSRS 2012 Report Server URL. We need to reference the ReportService2010 web service, and you can reference it using the following command:

<ReportServer URL>/ReportService2010.asmx

How to do it...

Let's explore the code required to download the RDL files from your Report Server:

  1. Open PowerShell ISE as an administrator.

  2. Add the following script and run it:

    $VerbosePreference = "Continue"
    $reportServerUri  = "http://localhost/ReportServer/ReportService2010.asmx"
    $proxy = New-WebServiceProxy -Uri $reportServerUri -UseDefaultCredential
    
    $destinationFolder = "C:\SSRS\"
    
    #create a new folder where we will save the files
    #we'll use a time-stamped folder, format similar 
    #to 2012-Mar-28-0850PM...