PowerShell script to create many SharePoint sites in a site collection

All you need to change is the Site Title (@Subsites) and the Site Collection URL ($SiteCollectionURL):

Write-Output ” “
Write-Output “Creating Sub Sites”

$SiteCollectionURL = “http://yoursharepointsite/sitecollection/01″

$SiteCollectionTemplate = “SiteDefinitionTemplate#0”

$SiteCollectionLanguage = 1033

$SubSites = @(“Site Titel 1”, “Site Title 2”)

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 ” “
New-SPWeb $SiteUrl -Template $SiteCollectionTemplate -Name “Your Site Name:” $SubSites -UseParentTopNav -Language $SiteCollectionLanguage -Description “Document Library description” $SubSites
Write-Output ” “
#Write-Output “Site Created for ” += $SubSites[$i]
Write-Output ” “
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s