$SQLInstance = "SUNUCUADI\INSTANCE"
#default instance icin instance adi girmeye gerek yok.
add-pssnapin sqlserverprovidersnapin100 -ErrorAction SilentlyContinue
add-pssnapin sqlservercmdletsnapin100 -ErrorAction
$Path = "C:\Reports"
$Reports= Invoke-Sqlcmd -ServerInstance $SQLInstance -Query "SELECT REPLACE(path,Name,'') as [FolderName], Name, CAST(CONVERT(VARBINARY(MAX), [CONTENT]) AS XML) AS [ReportDefinition] FROM ReportServerold.dbo.catalog as c where c.type = 2" -MaxCharLength 10000000 -QueryTimeout 10000000 -ConnectionTimeout 10000000
Foreach ($Rpt in $Reports)
{
$OutFolder = $Rpt.FolderName
$OutName = $Rpt.name
IF(!(Test-Path "$Path\$OutFolder"))
{
New-Item -ItemType "Container" -Path "$Path\$OutFolder"
}
$Rpt.ReportDefinition | Out-File -encoding ascii -FilePath "$Path\$OutFolder\$OutName.rdl" -Force
}