Skip to content

Instantly share code, notes, and snippets.

@anelliaf
Last active October 1, 2020 18:15
Show Gist options
  • Select an option

  • Save anelliaf/7a43c7f5105d235ff9cdd969498ced7d to your computer and use it in GitHub Desktop.

Select an option

Save anelliaf/7a43c7f5105d235ff9cdd969498ced7d to your computer and use it in GitHub Desktop.
PowerShell script to list Power BI workspaces and export to Excel
Connect-PowerBIServiceAccount
#Get-PowerBIWorkspace | Get-Member
#$ws = Get-PowerBIWorkspace -Scope Organization -Filter "tolower(name) eq 'testworkspace'"
#$ws = Get-PowerBIWorkspace -Scope Organization | Where {($_.IsOnDedicatedCapacity -eq $true) -and ($_.State -eq "Active") -and ($_.Type -ne "PersonalGroup")}
$ws = Get-PowerBIWorkspace -Scope Organization -All
$workspace =
foreach ($w in $ws) {
[PSCustomObject] @{
Name = $w.Name
Type = $w.Type
State = $w.State
"Dedicated Capacity" = $w.IsOnDedicatedCapacity
}
}
$workspace | Export-Excel -Path C:\Temp\pbi_workspaces.xls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment