Forum Discussion
UncleLewis
3 years agoResponsive 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 UTF8Use
Invoke-PowerBIRestMethod -Url "groups/$wsid/users" -Method Getinstead
3 Replies
- lbendlinSuper User
Use
Invoke-PowerBIRestMethod -Url "groups/$wsid/users" -Method Getinstead
- sarava0483Frequent Visitor
This is very helpfull, can you also suggest on directly uploading the CSV file to sharepoint /onedrive folder.
- lbendlinSuper User
Same piping as above.