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

Uploading an SSRS report to Report Manager


In this recipe, we will upload an SSRS report (.rdl file) to the Report Manager.

Getting ready

You can use the sample RDL file that comes with this cookbook and save it in the C:\SSRS folder. The sample RDL file uses the AdventureWorks2014 sample database. Alternatively, use an RDL file that is readily available to you. Make sure to update the RDL file reference in the script to reflect where your report file is located.

How to do it...

These are the steps required to upload an RDL file to the Report Manager:

  1. Open PowerShell ISE as an administrator.

  2. Add the following script and run it:

    $reportServerUri  = "http://localhost/ReportServer/ReportService2010.asmx"
    $proxy = New-WebServiceProxy -Uri $reportServerUri -UseDefaultCredential 
    $type = $proxy.GetType().Namespace
    
    #specify where the RDL file is 
    $rdl = "C:\SSRS\Customer Contact List.rdl"
    
    #extract report name from the RDL file
    $reportName =  [System.IO.Path]::GetFileNameWithoutExtension($rdl)
    
    #get...