Online Training On SharePoint
                      

Tuesday, 20 April 2010

Script to Create multiple SharePoint Site Collections

I had a requirment where we need to create multiple site collections and sites. It is very time consuming to create sites from UI one by one. To create sharepoint sites in bulk we can use a PowerShell script.
To achieve this we will pass a CSV file to the PowerShell script. The CSV file has the data in the following format:

Url                                               Owner             Language       Template
http://localhost/sites/demo1 domain\administrator 1033                STS#0
http://localhost/sites/demo2 domain\administrator 1033                STS#0
http://localhost/sites/demo3 domain\administrator 1033                STS#0

lets store this file in C: drive and then I will import this CSV file using the PowerShell command. Now we can execute a PowerShell script which will create bulk SharePoint sites based on the data in the CSV file.

$csvfile='c:\BulkSiteCreation.csv'
import-csv $csvfile | where {new-spsite -Url $_.Url -OwnerAlias $_.Owner -Language $_.Language -Template $_.Template}
Post a Comment
Related Posts with Thumbnails