Last active
August 29, 2015 14:05
-
-
Save daveselias/7ae32f24d117a5d8c350 to your computer and use it in GitHub Desktop.
PS script for updating the Connection string value in SSRS shared data sources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$OldSource = 'MySQLServer-01' | |
$NewSource = 'MySQLServer-02' | |
$URL = 'http://ReportServerName/ReportServer/ReportService2010.asmx?wsdl' | |
$URI = New-Object System.Uri($URL) | |
$SSRS = New-WebServiceProxy -Uri $URI -UseDefaultCredential | |
$DataSources = ($SSRS.ListChildren("/data sources", $true)).path | |
ForEach($Source in $DataSources){ | |
$DS = $SSRS.GetDataSourceContents($Source) | |
IF($DS.ConnectString -like "*$OldSource*"){ | |
$String = $DS | |
$String.ConnectString = $String.ConnectString.Replace($OldSource,$NewSource) | |
$SSRS.SetDataSourceContents($Source,$string) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment