How can I display the associated children (room mailboxes, room lists, etc.) of a building in PowerShell? I get the error 'Cannot delete a place that has children' and need to identify them

I exported a CSV using the Get-PlaceV3 command, and after reviewing the Excel file, I couldn’t find any associated children (such as room mailboxes, room lists, or equipment) linked to the building.

However, when I try to delete the building using the Remove-Place command, it gives an error stating that there are associated children.

(Remove-Place: Status(StatusCode=“FailedPrecondition”, Detail=“Can not delete a place that has children”))

Despite searching for these resources, I can’t find any linked to the building. How can I display all the associated children for this building in PowerShell?

Hello, welcome to the forum. What is Get-PlaceV3? I’ve never encountered this cmdlet nor Remove-Place. Please provide details about these commands so we may have a chance to assist you.

I unfortunately don’t have any children in my places to fully test this script but I would think that all of the children should be listed with Get-PlaceV3. If so, this script should filter out for the children. Just change the $buildingIdentity assignment to your buildings identity.

# Assign variable with the identity of the building you are looking at.
$buildingIdentity = "YourBuildingIdentity"

# Get all metadata configured within the Places directory
$places = Get-PlaceV3

# Filter for the building you are looking at.
$building = $places | Where { $_.Identity -eq $buildingIdentity }

# Filter for all children of the parent
$children = $places | Where { $building.PlaceId -eq $_.ParentId }
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.