Skip to main content

PowerShell Commands for SQL Server Reporting Services (SSRS).

# Code Samples for PowerShell Commands for SQL Server Reporting Services
# https://gist.github.com/SQLvariant/6cc6d15320d2a877a946b83b873be1b2

<#1#>
Install-Module -Name ReportingServicesTools

Invoke-Expression (Invoke-WebRequest https://aka.ms/rstools)
<#2#>
Get-Command -Module ReportingServicesTools

<#3#>
https://github.com/Microsoft/tigertoolbox/raw/master/SQL-performance-dashboard-reports/SQL%20Server%20Performance%20Dashboard%20Reporting%20Solution.zip
Get-Help -Full Write-RsFolderContent

<#4#>
New-RsFolder -ReportServerUri http://localhost/ReportServer -Path / -Name MSSQLTips -Verbose

<#5#>
Write-RsFolderContent -ReportServerUri http://localhost/ReportServer -Path "C:\MSSQLTips\SQL Server Performance Dashboard\" -Destination /MSSQLTips -Verbose

<#6#>
Write-RsCatalogItem -ReportServerUri http://localhost/ReportServer -Path "C:\MSSQLTips\SQL Server Performance Dashboard\performance_dashboard_main.rdl" -Destination / -Verbose

<#7#>
Remove-RsCatalogItem -ReportServerUri http://localhost/ReportServer -Path /performance_dashboard_main -Verbose

<#8#>
Dir 'C:\MSSQLTips\SQL Server Performance Dashboard\' |
Out-GridView -PassThru |
Write-RsCatalogItem -ReportServerUri http://localhost/ReportServer -Destination /MSSQLTips -OverWrite -Verbose

<#9#>
$Reports = 'C:\MSSQLTips\SQL Server Performance Dashboard\historical_io.rdl', 'C:\MSSQLTips\SQL Server Performance Dashboard\historical_waits.rdl'
Write-RsCatalogItem -ReportServerUri http://localhost/ReportServer -Path $Reports -Destination / -OverWrite -Verbose

<#10#>
Dir 'C:\MSSQLTips\SQL Server Performance Dashboard\' -Filter wait*.Rdl |
Write-RsCatalogItem -ReportServerUri http://localhost/ReportServer -Destination /MSSQLTips -OverWrite -Verbose


<#11#>
Dir 'C:\MSSQLTips\SQL Server Performance Dashboard\' -Filter *.Rdl | 
WHERE LastWriteTime -GT 2017-01-01 |
Write-RsCatalogItem -ReportServerUri http://localhost/ReportServer -Destination /MSSQLTips -OverWrite -Verbose