SharePoint Online: PowerShell to List All Deleted Sites

Requirement: Find All Deleted Site Collections in SharePoint Online.

How to Get Deleted Sites in SharePoint Online?

Looking for a way to get all sites that have been deleted in SharePoint Online? Well, In this blog post, we’ll walk through the steps to use PowerShell to list all deleted sites in your tenant. You can then use this information to restore any of these sites if needed or permanently wipe out any deleted sites that might be taking up unnecessary space or URLs or simply want to audit the deleted sites in your tenant.

Deleted site collections are sent to the recycle bin in SharePoint Online and stay there for 93 days until they are purged permanently. To check if a site collection is deleted and exists in recycle bin,

  1. Login to SharePoint Online Admin Center >> Expand Sites >> Click on the “Deleted Sites” link from the left navigation (In classic Admin Center, Go to the “Site Collections” link from the left navigation and click on the “Recycle Bin” Icon)
    sharepoint online get deleted sites

From here, You can either restore or permanently delete the site collection!

PowerShell to Get Deleted Site Collections in SharePoint Online:

Using SharePoint Online Management Shell, you can get a list of deleted site collections as:

$AdminSiteURL = ""
#Connect to SharePoint Online
Connect-SPOService -URL $AdminSiteURL -Credential (Get-Credential)
#Get all Deleted Sites

This lists all deleted sites:

sharepoint online powershell list deleted sites

PnP PowerShell Get Deleted Sites in SharePoint Online

Similarly, you can get all deleted sites from the SharePoint Online tenant recycle bin using PnP PowerShell. Here is the PnP PowerShell to list deleted sites in SharePoint Online:

#Config Variables
$TenantURL = ""

#Connect to PnP Online
Connect-PnPOnline -Url $TenantURL -Interactive
#Get All Deleted Sites from Recycle Bin

How to check who deleted the SharePoint Online site?

To find out who has deleted a SharePoint Online site collection, do the following:

  1. Go to Office 365 Security & Compliance Center at
  2. Expand search >> Audit Log Search >> Select the Activities as “Deleted site” set the date parameters accordingly and hit search. 
  3. This will get you all sites deleted along with the user name who has deleted the site.
    how to check who deleted sharepoint online site

Please note, sites may be deleted as part of site policies, Office 365 group deletion, etc.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

5 thoughts on “SharePoint Online: PowerShell to List All Deleted Sites

  • Can we get the list with deleted time and deleted by exported to an excel ?

  • Hi Rajack, Im unable to restore a brand new site i was creating and in my company no ones knos who is the admin to grant me privileges or even to restore the deleted site. Please help. I could not understand the steps from the powershell.

  • Hi,

    By chance can we get user name that who deleted?



Leave a Reply

Your email address will not be published. Required fields are marked *