5

How to create a new site collection in existing web application but with new content database using powershell.

2
  • do you want to create new content database then new site collection or DB already created?
    – Waqas Sarwar MVP
    Jan 13, 2016 at 18:08
  • i want to create new content database , with new site collection , and after my purpose is dismount and mount existing sharepoint 2010 content database and upgrade sp 2010 content db to sp 2013
    – adilahmed
    Jan 13, 2016 at 19:00

2 Answers 2

4

You can use:

New-SPSite -Url $url –ContentDatabase $ContentDatabase -Name $WebsiteName –Description $WebsiteDesc  -Template $Template -OwnerAlias $PrimaryLogin –OwnerEmail $PrimaryEmail

see: https://social.technet.microsoft.com/forums/sharepoint/en-US/89c90032-5be1-4fe6-8546-0114eaf018ca/site-collection-in-a-particular-content-database

3
  • i want to create publishing site ,in sp 2013 what is the template id for publishing site?
    – adilahmed
    Jan 13, 2016 at 19:04
  • when i use above powershell its showing error New-SPSite : The content database could not be found. At line:1 char:1 + New-SPSite -Url "xxxxx/bi" -ContentDatabase "Wss_content_ ...
    – adilahmed
    Jan 13, 2016 at 19:37
  • See the comment below by Waqas
    – Oak3
    Jan 13, 2016 at 20:52
9

You have to create the Content Database 1st then you will be able to create new site collection.

New-SPContentDatabase -Name "database name" -DatabaseServer "database server name"  -WebApplication "web app url"

$dbname = Get-SPContentDatabase "databasename"

New-SPSite -URL $site -OwnerAlias $owner1 -SecondaryOwnerAlias $owner2 -ContentDatabase $dbname -Template "BLANKINTERNET#0"

For site template codes, please check this blog. http://www.funwithsharepoint.com/sharepoint-2013-site-templates-codes-for-powershell/

1
  • Hi thanks, after that i want to mount sp 2010 content database to this new site collection and want to do migration to sharepoint 2013
    – adilahmed
    Jan 14, 2016 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.