In SharePoint 2019, I have a subsite that holds many subsites and when trying to delete the main subsite I got this error "Sites that have subsites or certain apps can't be deleted"
Sorry, something went wrong
There was a problem deleting Web site "/subsite". Sites that have subsites or certain apps can't be deleted. Please try again after deleting all subsites and removing the apps.
Actually, I can't delete all subsites one by one, it's about 30 subsites, so I am looking for a PowerShell script that deletes all subsites under the parent site to avoid this error!