Find Orphaned SharePoint Sites After Teams Cleanup: Step-by-Step Setup
🔍 WiseChecker

Find Orphaned SharePoint Sites After Teams Cleanup: Step-by-Step Setup

When you delete a Microsoft Teams team, its associated SharePoint site often remains in the SharePoint admin center. These orphaned sites continue to consume storage and may expose content to users who still have access. You need a method to identify these sites so you can delete or repurpose them.

Orphaned sites occur because SharePoint does not automatically remove the site when the connected Microsoft 365 group is deleted. The site becomes disconnected from any group but remains active in SharePoint.

This article explains how to use PowerShell and the SharePoint admin center to find orphaned sites. You will learn a repeatable process to list sites that no longer have a Microsoft 365 group owner.

Key Takeaways: Finding Orphaned SharePoint Sites After Teams Cleanup

  • SharePoint admin center > Active sites > Group column: Shows whether a site is connected to a Microsoft 365 group. Empty values indicate potential orphaned sites.
  • Get-SPOSite PowerShell cmdlet: Lists all SharePoint sites. Filter by GroupId to find sites with no group association.
  • Remove-SPOSite PowerShell cmdlet: Permanently deletes a site after confirming it is orphaned. Use with caution and always back up data first.

ADVERTISEMENT

Why Orphaned SharePoint Sites Appear After Teams Cleanup

Each Microsoft Teams team is backed by a Microsoft 365 group. That group owns a SharePoint team site, a shared mailbox, a calendar, and other resources. When you delete a team from the Teams admin center, the Microsoft 365 group is deleted. However, the SharePoint site is not automatically removed. The site becomes orphaned because its group owner no longer exists.

Orphaned sites remain fully functional. Users who had access before the group deletion can still access the site. The site continues to count against your SharePoint storage quota. Over time, orphaned sites can accumulate and cause confusion about which content is still active.

SharePoint does not provide a built-in report for orphaned sites. You must use the site collection properties to determine whether a site is connected to a group. The key property is the GroupId attribute. If GroupId is empty or does not match an existing Microsoft 365 group, the site is orphaned.

Steps to Find and Remove Orphaned SharePoint Sites

You will use two methods to identify orphaned sites: the SharePoint admin center graphical interface and PowerShell. The PowerShell method is more accurate for bulk operations. The admin center method works for a quick check on a few sites.

Method 1: Check Orphaned Sites in SharePoint Admin Center

  1. Open SharePoint admin center
    Sign in to Microsoft 365 admin center at admin.microsoft.com. In the left navigation, select Admin centers and then SharePoint. Alternatively, go directly to admin.microsoft.com/SharePoint.
  2. Go to Active sites
    In the left menu of the SharePoint admin center, select Policies and then Active sites. This page lists all SharePoint sites in your tenant.
  3. Add the Group column
    Click the Columns button near the top-right of the site list. In the column picker, check the box next to Group. Click Apply. The Group column now shows the name of the connected Microsoft 365 group for each site. Sites with a blank Group column are potential orphaned sites.
  4. Export the site list
    Click Export at the top of the page. A CSV file downloads. Open the file in Excel. Filter the Group column to show only blank cells. The resulting rows are sites that likely have no group owner. Note the URL of each site.

Method 2: Use PowerShell to Find Orphaned Sites

This method is faster for tenants with many sites. You need the SharePoint Online Management Shell module installed.

  1. Install the SharePoint Online Management Shell
    Open Windows PowerShell as an administrator. Run Install-Module -Name Microsoft.Online.SharePoint.PowerShell. If prompted, select Yes to All to install the NuGet provider and the module.
  2. Connect to SharePoint Online
    Run Connect-SPOService -Url https://yourtenant-admin.sharepoint.com. Replace yourtenant with your tenant name. Enter your global admin or SharePoint admin credentials when prompted.
  3. Get all site collections with group details
    Run the following command to retrieve all sites and their GroupId values:
    Get-SPOSite -IncludePersonalSite $false -Limit All | Select-Object Url, GroupId, Title
    This returns a list of all site URLs and their associated GroupId. Sites with a blank GroupId field are orphaned.
  4. Filter for orphaned sites
    Run this command to output only sites with no GroupId:
    Get-SPOSite -IncludePersonalSite $false -Limit All | Where-Object { $_.GroupId -eq [Guid]::Empty } | Select-Object Url, Title
    Review the output. These sites have no group owner and are orphaned.
  5. Verify the group does not exist
    For extra safety, check if the GroupId actually matches a deleted group. Run:
    $orphanedSites = Get-SPOSite -IncludePersonalSite $false -Limit All | Where-Object { $_.GroupId -ne [Guid]::Empty }
    foreach ($site in $orphanedSites) {
    try {
    Get-UnifiedGroup -Identity $site.GroupId -ErrorAction Stop | Out-Null
    } catch {
    Write-Output "Orphaned site found: $($site.Url)"
    }
    }

    This script checks sites that have a GroupId but the group no longer exists. These are also orphaned.

Method 3: Remove Orphaned Sites

  1. Back up site content
    Before deletion, export any data you need. Use the SharePoint admin center to go to the site, then select Settings > Export site. This creates a downloadable package of the site content. For large sites, consider using a third-party backup tool.
  2. Delete the site via PowerShell
    Run the following command for each orphaned site URL:
    Remove-SPOSite -Identity https://yourtenant.sharepoint.com/sites/orphanedsite
    Replace the URL with the actual site URL. When prompted, confirm the deletion. The site moves to the SharePoint recycle bin.
  3. Permanently delete from recycle bin
    To free storage immediately, run:
    Remove-SPOSite -Identity https://yourtenant.sharepoint.com/sites/orphanedsite -NoWait
    Or go to the SharePoint admin center > Recycle bin and delete the site permanently.

ADVERTISEMENT

If Orphaned Sites Are Not Detected Correctly

SharePoint admin center shows a group name but the group is deleted

The Group column in the admin center displays the group name from cached data. It may show a group even after the group is deleted. Use the PowerShell method in step 5 of Method 2 to verify whether the group actually exists. The PowerShell script that checks Get-UnifiedGroup will catch these false positives.

PowerShell returns no orphaned sites but you know sites exist

Ensure your PowerShell account has SharePoint admin privileges. Run Get-SPOSite -Limit All without filters to see all sites. If the site list is incomplete, your tenant may have more than 20,000 sites. Use the -Limit All parameter and pagination to retrieve all sites. Alternatively, use the SharePoint admin center export method which handles large numbers of sites.

The Remove-SPOSite cmdlet fails with access denied

You need SharePoint admin or global admin rights to delete sites. If you are a site collection administrator, you cannot delete a site from PowerShell. Use the SharePoint admin center to delete the site instead. Go to Active sites, select the site, and click Delete.

Item SharePoint Admin Center PowerShell
Best for Quick checks on a few sites Bulk operations on many sites
Requires admin role SharePoint admin or global admin SharePoint admin or global admin
Detects orphaned sites by Blank Group column Empty GroupId or nonexistent group
Can delete sites Yes, individually Yes, in bulk
Handles 20,000+ sites Yes, via export CSV Yes, with pagination

You can now identify orphaned SharePoint sites that remain after Teams cleanup. Use the SharePoint admin center for a quick visual check or PowerShell for a thorough audit. Always verify the group status before deleting. After deletion, monitor your storage quota to confirm the sites are removed. As an advanced tip, schedule a weekly PowerShell script that sends an email report of orphaned sites to your IT team for proactive cleanup.

ADVERTISEMENT