Forum Discussion

JJenkins2005's avatar
JJenkins2005
Frequent Visitor
7 years ago

Update Shared Datasouce for Report using PowerShell

Hello,

 

We are in the process of migrating from SSRS to PBI-RS and have been testing reports in DEV using DEV Datasources.  We have over 300 reports, that we need to switch to Production Datasources, and I've been looking for a way to do it via powershell.. As a NOOB, I'm running into issues.   I downloaded the ReportingServicesTools and it looked like it would be pretty simple... NOPE...   I found that I should be using the Get-RSITEMDatasource and Set-RSITEMDatasource based on  my reading.. so I Ran the following:

 

PS C:\> $dataSources = Get-RsItemDataSource -ReportServerUri 'http://powerbi.dev.sql.odnss.com/Reportserver/' -RsItem '/docket/All Timekeepers'

 

Ran Succesfully

 

Then I ran

 

 

PS C:\> Set-RsItemDataSource -DataSource $datasources -RsItem '/AR/AR Aging' -ReportServerUri 'http://powerbi.dev.sql.odnss.com/reportserver/'

 

I get the error below


Please use Set-RsDataSource to update shared data sources!
At C:\Program Files\WindowsPowerShell\Modules\ReportingServicesTools\0.0.5.0\Functions\CatalogItems\Set-RsItemDataSource.ps1:143 char:17
+ ... throw "Please use Set-RsDataSource to update shared data ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Please use Set-...d data sources!:String) [], RuntimeException
+ FullyQualifiedErrorId : Please use Set-RsDataSource to update shared data sources!

 

 

I'm not trying to update the Shared Datasource itself... I'm simply tying to update the report to use another Shared Datasouce.. 

 

What am I doing wrong? 

7 Replies

  • I'm stuck at the exact same place. So baffled. Did you ever get this to work? Thanks!

    • d_gosbell's avatar
      d_gosbell
      Super User

      If you want to point to a different shared data source you need to use the Set-RsDataSourceReference cmdlet

      • erico's avatar
        erico
        New Member

        Hi d_gosbell

         

        Thank you for the quick response. After reading through the help file for Set-RsDataSourceReference, the examples don't appear to align with my goal. 


        I ended up picking apart the function "Set-RsItemDataSource' and grabbing the last section. 

        https://imgur.com/Y3B2OE6


        This ended up working and set my data source correctly. 

         

        My goal was to set the report data source to this. Does this look sane?

        https://imgur.com/pSvkzTI

         

        Thanks! 

        Eric