Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Fetching the GroupName for groups having access to Workspace

Hi!
When running this script I get the ID in the "user column" for groups and distributionlists.
I need the "Name of the group", how do I do that and where do I find it? 
And I also need to fetch the users in that group, if possible?

#$Workspaces = Get-PowerBIWorkspace -Scope Organization -All 
$Workspaces = Get-PowerBIWorkspace  -Id "XXXX" -Scope Organization

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

 

1 Reply