Search This Blog

Sunday, January 10, 2016

How to create subsites using powershell

param(
[string]$SiteCollectionURL,
[string]$SiteCollectionTemplate,
[string]$SiteCollectionLanguage,
[string]$SubSites
)
Try
{
$SiteUrl = ""
$SiteUrl = $SiteCollectionURL + "/"
$SiteUrl = $SiteUrl += $SubSites
#Write-Host $SiteUrl
New-SPWeb $SiteUrl -Template $SiteCollectionTemplate -Name $SubSites  -UseParentTopNav -Language $SiteCollectionLanguage -ErrorAction Stop
}
Catch
{
write-host "Exception Message: $($_.Exception.Message)" -foregroundcolor red
}

No comments:

Post a Comment