Friday, June 16, 2017

Create New Content Database Using SharePoint PowerShell

Execute following script to create new content database using SharePoint PowerShell. You can run this script on any WFE or APP server.

add-pssnapin Microsoft.SharePoint.PowerShell

#Set following parameters
$WebsiteName = "Test Site"
$DbServer = "SQLServer"
$WebAppUrl = "http://webapplink"
$DBName = "WSS_Content_" + $WebsiteName
$MaxSiteCount = 1 

$WarningSiteCount = 0

#Create new content database
New-SPContentDatabase -Name $DBName -DatabaseServer $DbServer -WebApplication $WebAppUrl -MaxSiteCount $MaxSiteCount -WarningSiteCount $WarningSiteCount -ErrorAction Stop

No comments: