SharePoint and Teams

How to clean up test SharePoint sites and teams

Learn how to report on and remove SharePoint sites and teams created for testing purposes to reduce clutter and free up storage space on your tenant.
Scott Ortlepp
Updated
July 3, 2024
4 min to read

We've all done it. We create a site or team to quickly test new functionality, but then never use it again and forget to delete it. When several people do this, over time your tenant can easily end up with dozens or even hundreds of test sites.

How to identify test sites and teams

Caveat: If testing (for example of products or services) is part of the operational activities in your organisation, a cleanup of this nature might be quite involving because your list of results will contain a large number of workspaces which are genuinely required and not superficial or obsolete. Even if this is the case, it could still be worthwhile to periodically report and review to identify ones to remove.

Simple identification

Workspaces are considered test spaces when the word ‘test’ is contained in the site/team name.

Thorough identification

If you want to be more thorough, you can also consider whether the names of libraries, folders or files contain the word 'test'.

Method 1 – Admin centers

The admin center method only allows for simple identification.

Teams admin center

Before you begin, confirm that you have the Teams administrator role. Once confirmed, follow these simple steps:

  1. From the Teams admin center, navigate to ‘Manage teams’ below the ‘Teams’ tab on the left navigation.
  2. In the ‘Search for a team’ search  box, enter the word ‘Test' and run a search.

From the results returned, review each with the owner(s) and delete any confirmed not necessary anymore.

SharePoint admin center

Before you begin, confirm that you have the SharePoint administrator role. Once confirmed, follow these simple steps:

  1. From the SharePoint admin center, navigate to ‘Active sites’ below the ‘Sites’ tab on the left navigation.
  2. In the ‘Search sites’ search box, enter the word ‘Test’ and run a search.

From the results returned, review each with the owner(s) and delete any confirmed to not be needed anymore.

Microsoft 365 admin center

Before you begin, confirm that you have the Exchange administrator role. Once confirmed, follow these simple steps:

  1. From the Microsoft 365 admin center, navigate to ‘Active teams & groups’ below the ‘Teams & groups’ tab on the left navigation.
  2. In the ‘Search all teams and groups’ search box, enter the word ‘Test’ and press enter.

Review the results with the owner(s) and delete any workspaces confirmed to not be needed anymore.

Method 2 – PowerShell

The PowerShell method only allows for simple identification.

Managing test teams

Before you run one of the following commandlets, you will need to ensure that you have the Teams administrator role, have the Microsoft Teams module installed, authorized, and connected.

Report on test teams

To find test teams within your tenant, use the following commandlet:

Get-Team | where-object {$_.DisplayName -like ("*Test*")} 

If you want to export a report, use the following script: Report on test Teams

Delete test teams

To delete a team, use the following commandlet:

Remove-Team -GroupId <Group ID>

Managing test SharePoint sites

Before you run one of the following commandlets, you will need to ensure that you have the SharePoint administrator role, have the SharePoint Online Management module installed and authorized.

Report on test SharePoint sites

To find test SharePoint sites within your tenant, use the following commandlet:

Get-PnPTenantSite | where-object{$_.Title -like ("*Test*")}

If you want to export a report, use the following script: Report on test SharePoint sites

Delete  test SharePoint sites

To delete a SharePoint site, use the following commandlet:

Remove-PnPTenantSite -Url "<Site URL>" 

Managing test 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 test groups

To find test M365 groups within your tenant use the following commandlet:

Get-UnifiedGroup | Where-Object {$_.DisplayName -like("*Test*")} 

If you want to export a report, use the following script: Report on test M365 Groups

Delete test groups

To delete a M365 group, you can use the following commandlet:

Remove-UnifiedGroup -Identity "<Group UPN>"

Method 3 – Third-party tool

SProbot's test workspace cleanup tool makes it possible to more thoroughly evaluate whether sites contain test-related content by looking not just at the site name, but also at the names of libraries, folders and files inside the site. If any mention of 'test' is found, the tool flags the sites it identifies as "May be a test site" and enables bulk review and deletion.

Quirks of deleting test workspaces

Before deleting a test workspace, ensure you are performing the action against the correct resource. Deleting group-connected SharePoint sites via script can cause issues if the connected group is not deleted along with it.

If your organization performs a lot of testing of products or services (the software industry is a good example), it may be worth keeping around some test workspaces as they enable those using them to better understand the functionality available within the workspaces, both current and for future updates Microsoft may bring.

Conclusion

Removing test workspaces from your environment ensures that no unnecessary space is consumed on your tenant, and reduces search results clutter, making it easier for people to quickly find the exact SharePoint site or team they're looking for to get their job done.

Need an easy way to clean up testing sites?
Use SProbot's tenant cleanup tools to find and remove sites and teams which were created for testing purposes only
Get useful SharePoint and Teams insights first

See how SProbot can help you keep your M365 tenant tidy

We'll show you how to tame content sprawl and make it easier for your users to find what they need

Get a demo