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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
UncleLewis
Responsive Resident
Responsive Resident

Powershell Script List Users In Power BI Workspaces

Hi all,

 

Trying to use a Powershell script to output a csv file of all users in each workspace.

 

I found a PS script and it creates a csv file, but the file contains 3 weird characters in cell A1.

I checked a workspace and I see 65 users.

Any ideas here:

Thanks,

-w

 

Connect-PowerBIServiceAccount

$Workspaces = Get-PowerBIWorkspace -All 

$Workspaces | 
    ForEach-Object {
        $Workspace = $_.name
        foreach ($User in $_.Users) {
            [PSCustomObject]@{
                Workspace = $Workspace
                User      = $User.UserPrincipalName
            }
        }
    } | Export-CSV "C:\\PowerBIGroupMembers.csv" -NoTypeInformation -Encoding UTF8
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Use 

Invoke-PowerBIRestMethod -Url "groups/$wsid/users" -Method Get

instead

View solution in original post

3 REPLIES 3
sarava0483
Frequent Visitor

This is very helpfull, can you also suggest on directly uploading the CSV file to sharepoint /onedrive folder.

Same piping as above.

lbendlin
Super User
Super User

Use 

Invoke-PowerBIRestMethod -Url "groups/$wsid/users" -Method Get

instead

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.