Forum Discussion
Deleted reports showing up in workspace inventory powershell
Hi,
Have some powershell which gets a list of reports in their workspaces.
if have a report and delete it and the replace it with another report in same workspace shows the 2 entries the live one and the deleted one when shoudl onky show one - the live active one.
When check workspace only one report of that name is in that workspace but shows 2 entries.
How can we only show the live reports in that workspace.
Login-PowerBI
$Workspaces = Get-PowerBIWorkspace -Scope Organization -Include Reports | Where {($_.Name -NotLike "Personal*")}
$Reports =
ForEach ($workspace in $Workspaces)
{
# exclude personal workspaces
#$SearchTerm = '*Personal*'
#If ($workspace -NotLike $SearchTerm)
#{
Write-Host $workspace.Name
ForEach ($report in (Get-PowerBIReport -Scope Organization -WorkspaceId $workspace.Id))
{
[pscustomobject]@{
#WorkspaceID = $workspace.Id
WorkspaceName = $workspace.Name
#ReportID = $report.Id
ReportName = $report.Name
ReportURL = $report.WebUrl
#ReportDatasetID = $report.DatasetId
}
}
}
#}
$Reports | Export-Csv "C:\pbi_pshell\workspace_inventory.csv" -NoTypeInformation
for deleted ones when click the url