In the post, SQL Server Reporting Services buid and deploy automation, we used Write-RsFolderContent to deploy the source artifacts to the server, you can see the Write-RsFolderContent source code here.
Because Write-RsFolderContent does not have an special order over the items it sends to the report server you will end up with reports, and shared DataSets, DataSource connections links broke, in the report server database.
To prevent this you can create the DataSouces before invoking the Write-RsFolderContent.
To complement the previous post I had to invoke the following PowerShell script before executing Write-RsFolderContent, once for witch Data Source, the orchestration is done by our deployer application written in NANT version 0.92.
Param ( [string]$sourceFolder = $(throw "sourceFolder is required."), #required parameter, [string]$sqlConnectionString = $(throw "sqlConnectionString is required."), # connection string to report server [string]$folderPath = $(throw "folderPath is required."), # report folder path [string]$FolderName = $(throw "FolderName is required."), # report folder name [string]$name = $(throw "parameter name is required.") # data source name ) $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition $scriptPathInclude = $scriptPath + "\log.ps1" $scriptPathIncludeRS = $scriptPath + "\ReportingServicesTools\ReportingServicesTools.psd1" $scriptPathPassword = $scriptPath + "\Get-Password.ps1" # Garantir importação manual dos comandos, caso nÃo estejam definidos if (-Not (Get-Command "LogMessage" -errorAction SilentlyContinue)) { write-Output "A importar " $scriptPathInclude . $scriptPathInclude } #Importar as reporting services power shell tools LogMessage('A importar ' + $scriptPathIncludeRS ) Import-Module "$scriptPathIncludeRS" -Force try { $folderExists = $false #Set Verbose Mode $VerbosePreference = "continue" $folders = Get-RsFolderContent -RsFolder $folderPath -ReportServerUri $sqlConnectionString foreach ($element in $folders) { If($element.Name -eq $folderName -And $element.TypeName -eq "Folder" ) { $folderExists = $true break } } #Criar folder no root do report server If($folderExists -eq $false) { New-RsFolder -ReportServerUri $sqlConnectionString -Path $folderPath -Name $folderName -Verbose } #Create Shared Resources $dsPath = $sourceFolder + "\" + $name + ".rds" $newRSFolderPath = $folderPath + "/" + $FolderName Write-RsCatalogItem -ReportServerUri $sqlConnectionString -Path $dsPath -RsFolder $newRSFolderPath -Overwrite -Verbose Exit 0 } Catch { LogMessage ('[EXCEPTION] ' + $_) $err = $_.Exception while ( $err.InnerException ) { $err = $err.InnerException LogMessage $err.Message }; continue throw $_.Exception; }