Delete Particular Subsite using Powershell

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"

$ParentSiteUrl = "http://spgalaxy:1025"

function DeleteSubSite([string]$SiteUrlName)
{
$SiteUrlName = $ParentSiteUrl + $SiteUrlName
Write-Host "SiteUrlName:" $SiteUrlName

Remove-SPWeb $SiteUrlName -Confirm:$false
Write-Host "Web:" $SubWeb.Title " deleted!"
}

DeleteSubSite "Planet"

rm function:/DeleteSubSite

Write-Host "Finished! Press enter key to exit." -ForegroundColor Green
Read-Host

No comments:

Post a Comment