SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are migrating MOSS to SP2010 and have a library with hundreds of SSRS reports that use a Shared DataSource (in SharePoint Integrated mode.) Since the ReportServer database location has also changed, we lose all of the connection data between the reports and their Shared DataSource. Rather than going through each report in the UI to "Manage Data Sources," I would like to update all of the reports via Powershell.

I've made it as far as being able to isolate the report files in a foreach loop, but am not sure how to assign the datasource property.

Here is what I have so far:

$web = Get-SPWeb -Identity "" 
$list = $web.GetList("") 

$folder = $web.GetFolder($folderUrl)

foreach ($file in $folder.Files) { 
    If ($".rdl"))  {
        write-host $file.Name

I guess I could write a console app to do this, but I'm trying to learn how to make my life easier with Powershell. Thanks for any help offered.

On a side note, if I backup and restore the ReportServer database in the new location, would that solve this issue?

share|improve this question

You may use powershell to set the new DataSource. As noted from this blog post, you can use Set-SSRSDataSourceInfo.

Set-SSRSDataSourceInfo will set the Data Source URL for every report in a Document Library. Simply run the function with a Document Library URL, Data Source Name and Data Source URL parameters.

share|improve this answer
This is an amazing Cmdlet. If only I knew about this 2 years ago... :) – James Love Jun 30 '15 at 10:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.