Subscribe:

Labels

Thursday, September 27, 2018

Creating Subsite in Top level site collection.


#Creating Sub Sites in top site collection.
 Write-Output " "
 Write-Output "Creating Sub Sites"

$SiteCollectionURL = "http://abc.com"

#$SiteCollectionTemplate = "STS#0"

$SiteCollectionLanguage = 1033

$SubSites = @("ISubSite1")

 for($i=0 ; $i -lt $SubSites.count ; $i++)
 {
 $SiteUrl = ""
 $SiteUrl = $SiteCollectionURL + "/"
 $SiteUrl = $SiteUrl += $SubSites[$i]
 Write-Output " "
 #Write-Output "Creating Site for " += $SubSites[$i]
 Write-Output " "
 #"created url - "+$SiteUrl
 New-SPWeb $SiteUrl -Name $SubSites[$i]  -UseParentTopNav -Language $SiteCollectionLanguage
 Write-Output "Created the site"+$SiteUrl
 Write-Output "Importing the site"+$SiteUrl
 Import-SPWeb -Identity $SiteUrl -Path "C:\TEMP\bkinsiderep.cmp" -IncludeUserSecurity -Force
 #Write-Output "Site Created for " += $SubSites[$i]
 Write-Output " "
 }

# Remove-PsSnapin Microsoft.SharePoint.PowerShell

No comments:

Post a Comment