Saturday, October 20, 2012

Delete Particular Subsite using Powershell

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

$ParentSiteUrl = "http://globas:1050/"

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

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


DeleteSubSite "sun"

rm function:/DeleteSubSite

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

No comments:

Post a Comment