Forum Discussion
Update Shared Datasouce for Report using PowerShell
If you want to point to a different shared data source you need to use the Set-RsDataSourceReference cmdlet
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.
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?
Thanks!
Eric
- d_gosbell6 years ago
Super User
erico wrote:
This ended up working and set my data source correctly.If you figured out a script that works for you then that's great. If you are getting the result that you desire then that is probably proof in itself. I'm not sure how else you would measure the sanity of this 🙂
- erico6 years agoNew Member
Hi d_gosbell,
Maybe "safe" is a better word lol. The section of the function I took is different than your recommendation. My concern is about the downstream effects, despite its immediate success.
Your recommendation sets the DataSource like this...
$Proxy.SetItemReferences($item, @($dataSourceReference))I set the DataSource like this...
$rsProxy.SetItemDataSources($rsItem, $newDataSource)Thanks,
Eric
- d_gosbell6 years ago
Super User
erico wrote:
Maybe "safe" is a better word lol. The section of the function I took is different than your recommendation. My concern is about the downstream effects, despite its immediate success.
Oh in terms of "safety" you should be very safe with calling api methods like this. I sometimes see people in this forum suggesting doing direct updates on the Report Server database and that is definitely unsafe. But the powershell commands go through the supported web api calls which have a bunch of validations and checks in place and should ensure that there are no unwanted downstream effects.