In this article I would like to share the PowerShell script that does the following:
- Create new content database
- Create new managed path
- Create new site collection
PowerShell Script
The following is the PowerShell Script that does that:
# Add Snap in
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell
}
# Create Content Database
New-SPContentDatabase -name "DATABASE-NAME" -WebApplication "http://WEB-APP-URL"
# Create Managed Path
New-SPManagedPath -RelativeURL "path/subpath" -WebApplication "http://WEB-APP-URL" -Explicit
# Create Site Collection
New-SPSite http://WEB-APP-URL/path/subpath -OwnerAlias DOMAIN\user -Name "Site Collection Title" -Template "STS#0" -ContentDatabase "DATABASE-NAME"
Confirmation
You can verify the new site using the URL:
You can verify the new managed path through "Central Administration" > "Main Page" > "Select web application" > "Managed Paths" (toolbar item).
You can verify the new content database through "Central Administration" > "Main Page" > "Manage Content Databases" link.
The same PowerShell script is attached with this article.
Summary
In this article we have explored the PowerShell script to create a new site collection with a new managed path & content database. I hope this will be useful for site conversion activities.