/ Powershell

Deleting a Site Collection from Recycle Bin in Sharepoint Online

Once every now and then I (or more often a Sharepoint developer) needs to remove a Site Collection to be able recreate it with the same name again. As of today, the only way I know how to do it, is the Powershell way. And the Powershell way is of course always the right way to go anyway so who cares? ;)

These few lines blow are all that is needed to:

  • Connect to SPO by Powershell
  • Delete the Site Collection
  • Delete the Site Collection from the Recycle Bin
$cred = Get-Credential
$SiteCollectionToDelete = "https://<tenantname>.sharepoint.com/sites/971G22"
Connect-SPOService https://<tenantname>-admin.sharepoint.com -Credential $cred

Get-SPOSite $SiteCollectionToDelete  | Remove-SPOSite
Get-SPODeletedSite $SiteCollectionToDelete  | Remove-SPODeletedSite

Simple enough!

Andreas Selevik

Andreas Selevik

Solution Architect specialized in Windows & Azure Architecture, Office 365, PowerShell, Identity management and automation. Manchester United fanatic, father, husband and a very good winner...

Read More