If your organization is very large or dynamic in nature with people joining and leaving at short intervals, it can be fairly easy for teams and SharePoint sites to become orphaned regularly. Even if this is not the case, content does still become orphaned over time.
How to determine when a team is orphaned
A team is orphaned when there are no owners assigned to it. Technically, this means the connected Microsoft 365 group does not have any owners.
How to determine when a SharePoint site is orphaned
Defining a SharePoint site as orphaned is more complex because SharePoint sites can be either group-connected or not.
1 – SharePoint sites without groups
SharePoint sites without groups are any sites that do not have a M365 group (Microsoft 365 group) connected to them, for example communication sites.
These sites are considered to be orphaned when there are no users assigned to the ‘Site Owners’ group within the site(this group is a SharePoint group and exists only within the site).
2 - Group-connected sites
Group-connected sites are, as the name suggests, connected to a Microsoft 365 group. These will always be team sites and are the default type when creating a new site from the SharePoint start page. There are three scenarios when a group-connected site can be considered orphaned:
1. No group owners – when there are no users assigned to the ‘Owner’ role of the connected Microsoft 365 group.
2. No site owners – when there are no users assigned to the ‘Site Owners’ group (like with sites without groups).
3. No group or site owners– when there are no users assigned to either the ‘Site Owners’ group or to the connected Microsoft 365 group.
Cleanup method 1 –Admin centers
This method uses the standard Teams, SharePoint or Exchange admin centers and does not require any scripting or code knowledge.
Find and delete orphaned teams using the Teams admin center
Before you begin, confirm that you have the Teams administrator role.
- From the Teams admin center, navigate to ‘Manage teams’ below the ‘Teams’ tab on the left navigation.
- Scroll through the teams on your tenant until you find a team with an orange exclamation mark ⚠️ in the ‘Owners’ column.
![](https://cdn.prod.website-files.com/62179fe53d0c5bd813a383f8/666aa3da846702a9fc624c5b_Teams%20Admin%20-%20Orphaned%20Sites%20-%20Report.gif)
From here, you will be able to either assign an owner to delete the orphaned team.
If you have hundreds of teams, this is not a very effective method of managing your orphaned teams and it doesn’t cover Microsoft 365 groups (M365 groups) that aren’t teams connected.
Find orphaned sites using the SharePoint admin center
This method doesn’t enable you to easily determine (at least not at a glance) which sites are orphaned, it only enables you to individually review each site’s membership.
Before you begin, confirm that you have the SharePoint administrator role.
- From the SharePoint admin center, navigate to ‘Active sites’ below the ‘Sites’ tab on the left navigation.
- Select the site you believe has become orphaned.
- In the fly-out panel, select the ‘Membership’ tab.
- If there are no users assigned in the ‘Owners’ section of the ‘Membership’ tab, the site is orphaned.
- Assign an owner or delete the site.
*Note: this only works with group-connected sites.
Find orphaned groups using the Exchange admin center
Before you begin, confirm that you have the Exchange administrator role.
- From the Exchange admin center, navigate to ‘Groups’ below the ‘Recipients’ tab on the left navigation.
- Apply the ‘Ownerless groups’ filter to display all orphaned M365 group workspaces.
*Note: The same filter is available from the Microsoft 365 admin center on the ‘Active teams & groups’ tab.
Cleanup method 2 – PowerShell
Managing ownerless M365 groups
Before you run one of the following commandlets, you will need to ensure that you have the Exchange administrator role and have the Exchange Online Management module installed, authorized and connected.
Report on orphaned groups
To find orphaned M365 groups within your tenant use the following commandlet:
Get-UnifiedGroup | Where-Object {-Not $_.ManagedBy}
If you want to export a report, use the following script: Report on Orphaned Groups
Add new owners to groups
To add a new owner to a group, you can use the following commandlets:
Add-UnifiedGroupLinks -Identity <M365 Group Primary SMPT Address> -LinkType "Members" -Links <User UPN>
Add-UnifiedGroupLinks -Identity <M365 Group Primary SMPT Address> -LinkType "Owners" -Links <User UPN>
To bulk add new owners to groups, use the following script: New Orphaned Group Owner
Delete orphaned groups
To delete a group, use the following commandlet:
Remove-UnifiedGroup -Identity <M365 Group Primary SMPT Address> -confirm:$False
To bulk delete groups, use the following script: Delete Orphaned Groups
Managing ownerless SharePoint sites
Before you run this script, you will need to ensure that you have the SharePoint administrator role, have the SharePoint Online Management module installed and authorized.
Depending on the type of SharePoint site you create, it will not always be M365 group connected, classic team sites and communication sites are the most common. To find the orphaned non-group-connected sites in your tenant, you can use the following PowerShell script: Report on Orphaned Sites
Cleanup method 3 – Third-party tool
SProbot’s orphan cleanup tool includes the ability to list both SharePoint sites and teams in a single report, and then either assign ownership or delete workspaces individually or in bulk.
![](https://cdn.prod.website-files.com/62179fe53d0c5bd813a383f8/668563a52e317ef8d6c82d76_featureimage-cleanup-orphans.webp)
Conclusion
Minimizing the number of orphaned SharePoint sites and teams can be a time consuming and often overlooked part of tenant maintenance. There are however significant upsides to preventing data loss and freeing up much needed storage availability.