I was recently looking for a way to bulk delete sub-sites as I was doing some testing with deploying subsites and realized the SharePoint Online PowerShell management pack doesn’t come with any cmdlet to get subsites and do an action with the items, so I went to work to build a simple tool using the SharePoint client object model that would allow me to delete all sub-sites under a site collection but not removing the root site.
Alas after a little time coding and testing we have the “SharePoint Online: Bulk Delete Sub-Sites”
In the URL field please enter the URL of the Site Collection you would like to delete all the sub-sites from (note: this will not remove the root Site collection only all the sub-sites underneath the root).
Enter in the Username/Password of an account with Site Collection Administrator Privileges, without this level of permission the tool will fail to work so please verify that you have Site Collection Administrator rights before running this tool
Click ‘Delete‘ and it will start deleting all your subsites, the tool is pretty quick to run through each subsites and delete I ran a test of 100 subsites and took under 30 seconds so the tool is quite quick and powerful.
Feel free to ask questions or make suggestions as I’m always looking to add more functionality into my developments.
You can download the tool from here