In this post we create Linked Report using PowerShell script.
Function bellow expect following parameters:
- $proxy – Reporting Services web proxy, how to get proxy, see this post Connect to Reporting Services with PowerShell
- $OriginReportPath – Report part of base report
- $NewPath – path for Linked Report
- $LinkedName – name for Linked Report
- $LinkedDescription – Linked Report description
Function uses SSRS Web Service method CreateLinkedReport.
function CreateLinkedReport($proxy,[string] $OriginReportPath, [string] $NewPath, [string] $LinkedName, [string] $LinkedDescription) { Write-Host "Create linked report: " $NewPath"/" $LinkedName $prop = New-Object -TypeName SSRS.ReportingService2005.Property $prop.Name = "Description" $prop.Value = $LinkedDescription [SSRS.ReportingService2005.Property[]] $props = @(New-Object SSRS.ReportingService2005.Property) $props[0] = $prop try { $Proxy.CreateLinkedReport($LinkedName,$NewPath,$OriginReportPath,$props) } catch [Exception] { Write-Host $_.Exception.Message } }
Lets try.
CreateLinkedReport $proxy "/ReportPath/BaseReport" "/NewDir/LinkedReportPath" "LinkedReportName" "LinkedReportDescription"