Over a million developers have joined DZone.

Working With SQL Server Reporting Server PowerShell

DZone's Guide to

Working With SQL Server Reporting Server PowerShell

Learn how to remap SSRS or SQL Server Reporting Server Database to an existing database by working with SSRS PowerShell.

· Database Zone ·
Free Resource

RavenDB vs MongoDB: Which is Better? This White Paper compares the two leading NoSQL Document Databases on 9 features to find out which is the best solution for your next project.  

In this post, we will see how to work with SSRS PowerShell so we can remap SSRS or SQL Server Reporting Server Database to an existing DB. We will see also how to restore SSRS encryption keys.

First, download the PowerShell SSRS Modules using NuGet for PowerShell (NuGet Provider), run PowerShell as admin, and type the following:

Install-Module -Name ReportingServicesTools

Because I didn’t have NuGet for PowerShell, I got the following message:

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program
Files\PackageManagement\ProviderAssemblies' or 'C:\Users\mradwan\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running
'Install-PackageProvider -Name NuGet -MinimumVersion -Force'. Do you want PowerShellGet to install and import the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):

By agreeing, it will install both NuGet and SSRS PowerShell Modules. To display all the commands in that module, type:

Get-Command -Module ReportingServicesTools

This will display all the commands:

Image title

To know how to use the needed command, type:

get-help set-rsdatabase

This will download the latest solution and display the solution. To see some examples of how to use that command, type:

get-help set-rsdatabase -examples

Image title


Change the SSRS database to map to the old DB (I used the new name of the machine):

Set-RsDatabase -DatabaseServerName MyServer_Name -Name MyReportServerDB_Name -IsExistingDatabase -DatabaseCredentialType ServiceAccount -Confirm:$false

Restore the SSRS encryption key:

Restore-RSEncryptionKey -Password 'MyPassword' -KeyPath 'C:\Partial Autoamtion\CRMSRSReportKey.snk'

And that's it!

Get comfortable using NoSQL in a free, self-directed learning course provided by RavenDB. Learn to create fully-functional real-world programs on NoSQL Databases. Register today.

database ,sql ,ssrs ,powershell ,tutorial ,encryption

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}