Forum Discussion

sjrrkb123's avatar
sjrrkb123
Helper III
5 years ago
Solved

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

  • Anonymous's avatar
    Anonymous
    5 years ago

    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. 

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.