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

Creating an SSRS folder


In this recipe, we create a timestamped SSRS folder.

Getting ready

Identify your SSRS 2014 Report Server URL. We will need to reference the ReportService2010 web service, and you can reference it using

<ReportServer URL>/ReportService2010.asmx

How to do it...

Let's explore the code required to create an SSRS folder programmatically:

  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
    
    #A workaround we have to do to ensure
    #we don't get any namespace clashes is to
    
    #capture automatically generated namespace
    #this is a workaround to avoid namespace clashes
    #resulting in using –Class with New-WebServiceProxy
    $type = $Proxy.GetType().Namespace
    
    #formulate data type we need
    $datatype = ($type + '.Property')
    
    #display datatype, just for our reference
    $datatype
    
    #create new Property
    #if we were using ...