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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.