Delete and Restore Site Collection using PowerShell in SharePoint Online Office 365

This SharePoint Online PowerShell tutorial explains, delete site collection SharePoint online PowerShell. We will also see how to restore the deleted site collection using PowerShell in SharePoint Online Office 365. We will also discuss how to delete SharePoint Online site collection permanently using PowerShell in SharePoint Online Office 365.

If you are new to PowerShell SharePoint Online, then you read following PowerShell SharePoint Online tutorial:

We can use Remove-SPOSite PowerShell cmdlets to move the site collection to the recycle bin in SharePoint Online Office 365. This command will not delete the site collection permanently instead it will just move to the recycle bin in SharePoint Online.

Just to let you know that you must be a SharePoint Online global administrator and a site collection administrator to run the below cmdlet.

Even if you are a SharePoint Online global administrator, it will not allow you to delete the site collection if you are not a site collection administrator.

PowerShell Command to delete SharePoint Online site collection

Below is the PowerShell command to delete the site collection in SharePoint Online Office 365.

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://onlysharepoint2013-admin.sharepoint.com -credential bijay@onlysharepoint2013.onmicrosoft.com
Remove-SPOSite -Identity https://onlysharepoint2013.sharepoint.com/sites/MySite -Confirm:$false
restore sharepoint online site collection using powershell

Once you run the command, the site will be moved to the recycle bin in SharePoint Online. See the fig below:

Delete sharepoint online site collection using powershell

Delete SharePoint Online Site Collection Permanently using PowerShell

If you want to permanently delete the site from the recycle bin, you can run Remove-SPODeletedSite command like below:

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://onlysharepoint2013-admin.sharepoint.com -credential bijay@onlysharepoint2013.onmicrosoft.com
Remove-SPODeletedSite -Identity https://onlysharepoint2013.sharepoint.com/sites/MySite -Confirm:$false

The above PowerShell cmdlets delete a SharePoint Online site collection permanently.

Restore Deleted Site Collection using PowerShell in SharePoint Online Office 365

Similarly, if you want to restore the deleted site collection from the recycle bin in SharePoint Online Office 365, you can run the below PowerShell cmdlets.

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://onlysharepoint2013-admin.sharepoint.com -credential bijay@onlysharepoint2013.onmicrosoft.com
Restore-SPODeletedSite -Identity https://onlysharepoint2013.sharepoint.com/sites/MySite
Delete and Restore Site Collection using PowerShell in SharePoint Online

Once you run the above command, the site collection will be get restored from the recycle bin in SharePoint Online Office 365.

How to delete site collection in SharePoint Online from Browser

Now we will see, how to delete site collection in SharePoint 2013/Online. Remember you need to be a SharePoint site collection administrator to delete site collection.

When you will delete a site in SharePoint, the site will be moved to the recycle bin, the site can be restored from the site collection recycle bin by a site collection administrator.

Delete SharePoint Online Site Collection from browser

A SharePoint Online Site collection can be deleted from the SharePoint Online admin center. Open SharePoint Admin Center and then from the left side choose site collections and then select the particular site and then click on Delete button like below:

Delete SharePoint online site collection

But to delete a subsite, you can open the site in the browser and then go to the Site Settings page. And there you can see “Delete this site” which is under Site Actions like below:

Delete SharePoint 2013 site

We can delete a site collection from the SharePoint 2013 central administration.

Delete SharePoint 2010 Site from browser

To delete a SharePoint 2010 site, Open the site in the browser and then click on Site Actions and then Site Settings as shown in the figure below.

delete sharepoint site

Then it will open the settings page, from the Settings page click on Delete this site as shown in the figure below:

Delete SharePoint 2010 Site

When you click on this link the Delete confirmation page will open which shows you the warning and will tell you what all will delete once you delete the site. Then click on Delete. This will delete your SharePoint site as well as its contents.

You may like following SharePoint PowerShell tutorials:

I hope this PowerShell SharePoint tutorial explains how to delete site collection in SharePoint Online using PowerShell?

How to permanently delete site collection using PowerShell in SharePoint Online Office 365? Also, how can we restore a deleted site collection from the recycle bin using PowerShell in SharePoint Online Office 365?

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>