Freigeben über


Delete Webs Recursive with PowerShell

 

$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