How to delete a SharePoint Online Site collection using PowerShell?
Import-Module Microsoft.Online.Sharepoint.PowerShell #Variables for processing $AdminSiteURL = "https://crescent-admin.sharepoint.com/" $AdminName = "email@example.com" $SiteCollURL = "https://crescent.sharepoint.com/sites/Sales" #Credentials to connect $SecurePWD = ConvertTo-SecureString "Password" –asplaintext –force $Credential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $AdminName, $SecurePWD #Connect to SharePoint Online Connect-SPOService -url $AdminSiteURL -credential $Credential #Delete SharePoint Online Site Collection Remove-SPOSite -Identity $SiteCollURL -NoWait -Confirm:$false Write-Host "Site collection has been deleted!"
Permanently Delete the SharePoint Online Site Collection:
When you delete a site collection, it goes to recycle bin. You may want to permanently delete that site collection to reuse the storage space or recreate a new site collection with the same URL.
#Remove Deleted SharePoint Online Site Collection permanently Remove-SPODeletedSite –identity $DeletedSiteCollURL -Confirm:$false
You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.