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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Power Shell command to extract Power BI Reports from Workspace.

Hi All, 

 

I am hitting an error when I try to scan through all the workspace in my organization stored in a text file and retrieve all the power bi reports using the power shell command.  Even I don't export to a text file, it runs for a while and then throws the same error. 

 

I read in another thread it could be due to the tenant being busy.  I tried executing this command at different times periods and it always results in an error.  Is there any way to fix it? 

 

Basically, I need to extract all the workspaces and artifacts under it in an excel or CSV format.   So I extract a workspace id first and then copied to a text file and scan through it to get the report details.  

 

foreach($line in Get-Content "C:\Mohan\PBIDetails\WorkspaceId.txt") {
if($line -match $regex){
#write-host $line
Get-PowerBIReport -Scope Organization -WorkspaceId $line | Export-Csv -NoTypeInformation –Path 'C:\Mohan\PBIDetails\pbreportws1.csv'
}
}

 

Mohan_Babu_0-1617232674209.png

 

The input file has list of workspace id's which i have extracted using another script.  Its just a single line of workspace id's. 

 

Mohan_Babu_1-1617232820482.png

 

2 REPLIES 2
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

v-lionel-msft_0-1617689277264.png

I created a similar script but I did not reproduce your problem.

 

 

v-lionel-msft_1-1617689402838.png

Try to run this command directly and set the value of the parameter ‘-Worksapce’ to a fixed value. If there is no error, then there is a problem with your other code.

 

Best regards,
Lionel Chen

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

 

 

lbendlin
Super User
Super User

Ask your tenant admin to run the inventory for you.  Much simpler that way.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.