Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
sjrrkb123
Helper III
Helper III

How to overwrite existing .pbix files using the Export-PowerBIReport PowerShell command

I have a script that runs on Friday and exports all reports from a given workspace to ensure that we have backups incase a report builder deletes a report.

 

Currently, I have it dynamically creating the folder for that friday's date and then exports the reports into it. However, I am using OneDrive as the file location and would like to leverage its version control (file history) capabilities by just overwriting the existing .pbix files in the backup folder.

 

Here is a snippet of what I am using for the Export-PowerBIReport command:

 

$filepath = $filepath_first + "\RandomName.pbix" 
Export-PowerBIReport -Id $randompbix -OutFile $filepath

 

 

I have tried including the "-Force" command but keep getting the following error 
"A parameter cannot be found that matches parameter name 'Force'."

 

Here is a snippet of what I tried:

 

$filepath = $filepath_first + "\RandomName.pbix" 
Export-PowerBIReport -Id $randompbix -OutFile $filepath -Force

 

 

Any tips would be appreciated

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @sjrrkb123 

Please refer to this blog to export power bi report by Power Shell: 

PowerShell Scripts to Export Power BI Reports to PBIX/PDF/PPT

Please check the if PS "Run As Administrator" / or check if the FPE user (that installed the client) Run the PS window .

After that check again The cmdlets you used above.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @sjrrkb123 

Please refer to this blog to export power bi report by Power Shell: 

PowerShell Scripts to Export Power BI Reports to PBIX/PDF/PPT

Please check the if PS "Run As Administrator" / or check if the FPE user (that installed the client) Run the PS window .

After that check again The cmdlets you used above.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.