Saturday, October 5, 2019

Delete Site Collection with Sub Sites

#Deleting a SharePoint Site Collection and its Subsites

#To begin, you will need to load the SharePoint Online module to be able to run commands in PowerShell. You must also replace the url "https://anjantech-admin.sharepoint.com" and use your SharePoint administrative site.

Import-Module Microsoft.Online.Sharepoint.PowerShell
$credential = Get-credential
Connect-SPOService -url https://anjantech-admin.sharepoint.com -Credential $credential

#This command will delete the SharePoint site collection. You must replace the url "https://anjantech.sharepoint.com/sites/SiteCollectionName" with your Sharepoint Online URL and use the Site Collection Name that is to be deleted for this script to work properly.

Remove-SPOSite -Identity https://anjantech.sharepoint.com/sites/SiteCollectionName -NoWait

No comments:

Post a Comment