In the last post I showed you how to remove a complete Office 365 SharePoint Online site collection via the web interface. Now I’ll show you to do it with PowerShell.
This time I want to remove a site collection whose URL is https://ciaops365.sharepoint.com/sites/bootcamp. You can see that it appears in the list of sites in the web interface.
Then you need to run the following command:
remove-sposite –identity <URL> –nowait
thus in my case:
remove-sposite –identity https://ciaops365.sharepoint.com/sites/bootcamp –nowait
You’ll then be prompted to confirm the deletion. Press Y to delete the site and send it to the recycle bin.
If you refresh the page with the list of site collections the deleted site collection no longer appears.
If you now got to the sites collection recycle bin you will see both sites that have been deleted. One via the web interface and the one just now via PowerShell.
PowerShell provides you an ability that the web interface doesn’t. You can delete the site from the recycle bin and remove it completely.
To do that you need to run the command:
remove-spodeletedsite –identity <URL>
thus in my case:
remove-spodeletedsite –identity https://ciaops365.sharepoint.com/sites/bootcamp
You need to confirm the permanent removal by pressing Y.
If you refresh the web page displaying the site collection recycle bin you will see that the site has been removed completely.
Since I don’t need the other site I deleted previously using the web interface I will use PowerShell again to remove it permanently.
If we check the site collection recycle bin in the web interface there are no more site collections in the recycle bin as expected.
PowerShell provides you with more options when it comes to managing Office 365 and that is why you should be using it if you aren’t already!