Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
I am looking for a PowerShell script to get all PBIX files from a folder on-premise PBI server using powershell script. Did anybody have a sample? I have a PowerShell script for retrieving SSRS reports .rdl files from a SSRS Report server and I tried to modify it to work with PBI files, but no luck so far. Here is the PS script for SSRS reports:
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Xml.XmlDocument");
[void][System.Reflection.Assembly]::LoadWithPartialName("System.IO");
$ReportServerUri = "http://ssrsserver01/ReportServer/ReportService2005.asmx";
$Proxy = New-WebServiceProxy -Uri $ReportServerUri -Namespace SSRS.ReportingService2005 -UseDefaultCredential ;
#check out all members of $Proxy
#$Proxy | Get-Member
#http://msdn.microsoft.com/en-us/library/aa225878(v=SQL.80).aspx
#second parameter means recursive
$items = $Proxy.ListChildren("/Sample Reports", $true) | `
select Type, Path, ID, Name | `
Where-Object {$_.type -eq "Report"};
#create a new folder where we will save the files
#PowerShell datetime format codes http://technet.microsoft.com/en-us/library/ee692801.aspx
#create a timestamped folder, format similar to 2011-Mar-28
$folderName = Get-Date -format "yyyy-MMM-dd";
$fullFolderName = "C:\Temp\" + $folderName;
[System.IO.Directory]::CreateDirectory($fullFolderName) | out-null
foreach($item in $items)
{
#need to figure out if it has a folder name
$subfolderName = split-path $item.Path;
$reportName = split-path $item.Path -Leaf;
$fullSubfolderName = $fullFolderName + $subfolderName;
if(-not(Test-Path $fullSubfolderName))
{
#note this will create the full folder hierarchy
[System.IO.Directory]::CreateDirectory($fullSubfolderName) | out-null
}
$rdlFile = New-Object System.Xml.XmlDocument;
[byte[]] $reportDefinition = $null;
$reportDefinition = $Proxy.GetReportDefinition($item.Path);
#note here we're forcing the actual definition to be
#stored as a byte array
#if you take out the @() from the MemoryStream constructor, you'll
#get an error
[System.IO.MemoryStream] $memStream = New-Object System.IO.MemoryStream(@(,$reportDefinition));
$rdlFile.Load($memStream);
$fullReportFileName = $fullSubfolderName + "\" + $item.Name + ".rdl";
#Write-Host $fullReportFileName;
$rdlFile.Save( $fullReportFileName);
}
Thank you in advance.
Regards
Peter
I use the "out-rsrestfoldercontent" cmdlet from the ReportingServicesTools module see https://github.com/microsoft/ReportingServicesTools
This downloads all the contents of a specified folder to a local folder with a single call.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
3 | |
3 | |
2 | |
2 |