Tuesday, June 7, 2011

Creating site Collection in its own Database


Creating site collection form CA is one of the easiest things but creating it with its own database is a little different, there are several ways to do it but I am going to do it using powershell:

//Get the webapplication in $wb variable
$wb = Get-SPWebApplication -Identity http://MySharePointServer:9001

//Get the desired name of the site collection’s database, we will create this DB later
$dbname = “Wss_content_MySite”

//Get url of the desired site collection
$SiteCollectionUrl = “http:// MySharePointServer:9001/”

//Create the new database
new-spcontentdatabase $dbname -databaseserver "SP2010Database" -webapplication $wb

//Create the site collection
new-spsite –url $SiteCollectionUrl -owneralias MyDomain\OwnerOfSiteCollection -Contentdatabase $dbname

After this is done and the first time you login to the site collection you will be prompted to select the template for the site and the users.

No comments:

Post a Comment