Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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

MariaDB TX, proven in production and driven by the community, is a complete database solution for any and every enterprise — a modern database for modern applications.

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 '2.8.5.201' 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 2.8.5.201 -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

rsdatabase-examples

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!

MariaDB AX is an open source database for modern analytics: distributed, columnar and easy to use.

Topics:
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 }}