Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
$web = Get-SPWeb "https://localhost/sites/webwithsubwebs/"
function RemoveSPWebRecursively([Microsoft.SharePoint.SPWeb] $web)
{
$subwebs = $web.GetSubwebsForCurrentUser()
foreach($subweb in $subwebs)
{
RemoveSPWebRecursively($subweb)
$subweb.Dispose()
}
Remove-SPWeb $web -Confirm:$false
}
RemoveSPWebRecursively $web