top of page
  • Twitter Social Icon
  • LinkedIn Social Icon
  • Facebook Social Icon
Search

Update SSRS Datasources in a directory

  • Writer: Don Richardson
    Don Richardson
  • Jun 28, 2019
  • 1 min read

So you need to update all the datasources on your SSRS server. Well just one directory for now.


UpdateDatasource -TargetURL $targetURL -reportFolderPath $targetDirectory -targetReportServer "<TargetServer>"


and here's the function:


function UpdateDatasource

{

Param ([string] $TargetURL, [string] $reportFolderPath, [string] $targetReportServer)


# Example: UpdateDatasource -TargetURL "http://<TargetReportServer>/reportserver/ReportService2010.asmx?wsdl" -reportFolderPath "/Staging_Miscellaneous" -targetReportServer <TargetServer>


$url = $TargetURL


#Set variables:

$reportserver = $targetReportServer;

$newDataSourcePath = "/Data Sources/<targetdatasource>"

$newDataSourceName = "<targetdatasource>";

$reportFolderPath = $reportFolderPath

#------------------------------------------------------------------------


$ssrs = New-WebServiceProxy -uri $url -UseDefaultCredential


$reports = $ssrs.ListChildren($reportFolderPath, $false)


$reports | ForEach-Object {

$reportPath = $_.path

Write-Host "Update " $reportPath " To: " $newDataSourceName

$dataSources = $ssrs.GetItemDataSources($reportPath)

$dataSources | ForEach-Object {

$proxyNamespace = $_.GetType().Namespace

$myDataSource = New-Object ("$proxyNamespace.DataSource")

$myDataSource.Name = $newDataSourceName

$myDataSource.Item = New-Object ("$proxyNamespace.DataSourceReference")

$myDataSource.Item.Reference = $newDataSourcePath


$_.item = $myDataSource.Item


$ssrs.SetItemDataSources($reportPath, $_)


}


Write-Host "------------------------"

}

}

 
 
 

Recent Posts

See All
One object Multiple implementations

So, I need to be able to execute a specific interface implementation based on the interface being used on the newly instantiated object....

 
 
 
System.Net.Http v4.2.0.0 not loading

So.. it turns out that the incorrect dll is loaded via nuget. As a work-around, redirect your manifest to look for 4.0.0.0 and it works....

 
 
 

Comments


  • Grey Twitter Icon
  • Grey LinkedIn Icon
  • Grey Facebook Icon

© 2023 by Talking Business.  Proudly created with Wix.com

Thanks for submitting!

SIGN UP AND STAY UPDATED!
bottom of page