hope its not too late. All the solutions I found on SO/online are for SSRS. The one below is for PowerBI RS (on-prem). It downloads all PBIX files in the same structure as the server. Additional details can be found here: https://www.bluegranite.com/blog/power-bi-report-server-devops
Make sure to install/update the module beforehand:
Install-Module -Name ReportingServicesTools;
And make sure to change the following two variables:
$ReportPortalUri
and
$LocalPath
#Installmodule
#Install-Module -Name ReportingServicesTools;
#Create new web session to your Power BI Report portal
$ReportPortalUri = 'https://PBIRS-onprem/Reports'; #Replace with your report server URL
$session = New-RsRestSession -ReportPortalUri $ReportPortalUri;
$LocalPath =’C:\Users\Test\Documents\PowerBI Export\'; #Specify local folder to download assets to
#Get Power BI and Excel reports from Power BI Report Server
#NOTE: Since we use SSDT for managing SSRS reports, we only wanted to download Power BI & Excel reporting assets
$reports = Get-RsCatalogItems -ReportServerUri $ReportPortalUri -RsFolder '/' -Recurse | Where {$_.TypeName -eq 'PowerBIReport' -Or $_.TypeName -eq 'ExcelWorkbook'};
#Export each report that was selected
foreach ($report in $reports)
{
$reportFolder = (Split-Path $report.Path).Substring(1)
$exportPath = $LocalPath + "\" + $reportFolder;
#Create folder if it does not exist
if (-Not (Test-Path $exportPath))
{
New-Item $exportPath -ItemType Directory | Out-Null;
}
#Export the report
Out-RsRestCatalogItem -Destination $exportPath -RsItem $report.Path -Overwrite -WebSession $session;
Write-Host "Report exported: $($report.Name)";
}