How to delete sites from SPO recycle bin

By default, when you delete a SharePoint Online site collection from the SharePoint admin center, it is moved to the Recycle Bin, where it is retained for a 30-day period. But, what if you don’t want to wait 30 days? Or you need the quota that the site collection has or even you need to create a new SC with the same url? To all those question, PowerShell is your answer, so let’s begin:

$cred=get-credential

$siteAdminURL = “https://yourtenanturl-admin.sharepoint.com”

Import-Module Microsoft.Online.SharePoint.PowerShell

connect-sposervice -url $siteadminurl -credential $cred

Get-SPODeletedSite | foreach {
Write-host “Deleting ” $_.Url
Remove-SPODeletedSite –Identity $_.Url –Confirm:$false
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s