.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Create Site Collection with New Managed Path, Content Database

Posted By:Jean Paul       Posted Date: May 26, 2014    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we will explore 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.
 

In this article I would like to share the PowerShell script that does the following:

  1. Create new content database
  2. Create new managed path
  3. 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:

Create-Site-Collection-with-New-Managed-Path- in-SharePoint-1.jpg 
You can verify the new managed path through "Central Administration"  > "Main Page"  > "Select web application" > "Managed Paths" (toolbar item).

Create-Site-Collection-with-New-Managed-Path- in-SharePoint-2.jpg

You can verify the new content database through "Central Administration" > "Main Page" > "Manage Content Databases" link.

Create-Site-Collection-with-New-Managed-Path- in-SharePoint-3.jpg

Create-Site-Collection-with-New-Managed-Path- in-SharePoint-4.jpg

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.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend