15 May, 2013

Create Site Collections, Subsites, Custom List by using PowerShell- SharePoint 2010


Creating of subsites, site collections, custom lists, and document libraries can be easily created by using GUI (i.e. Graphical User Interface) – very easy-correct? But let me tell you guys that all this activities are easier if you do it by using PowerShell. That’s why I am sharing the same so that you can use the following things in day to day activities.



What we are going to check in this article?
-Creation of site collections
-Creation of subsites
-Creation of custom list’s

HOW TO CREATE A SUBSITE IN SHAREPOINT 2010 BY USING POWERSHELL?

New-SPWeb –url<new site url> -name <new site name> -template <template name>

SUBSITE CREATION ALONG WITH SOME ADDITIONAL PARAMETERS:

New-SPWeb –url http://sharepoint2010/sites/MOSS2010/SUB2010 -name "All about SUBSITES" -template STS#0 –AddToTopNav –UniquePermissions –UseParentTopNav

HOW TO CREATE SITE COLLECTION IN SHAREPOINT 2010 USING POWERSHELL?

$siteURL = “http://sharepoint2010/sites/MOSS2010;

$owner = “moss2010/SPAdministrator1”

$secondOwner = “moss2010/SPAdministrator2”

$template = “STS#0″

$description = “PowerShell created Site Collection”

New-SPSite $siteURL -OwnerAlias $owner -SecondaryOwnerAlias $secondOwner -name “PowerShell for SharePoint” -Template $template -Description $description

HOW TO CREATE A CUSTOM LIST IN SHAREPOINT 2010 BY USING POWERSHELL?

$SPAssignment = Start-SPAssignment

$SPWeb = Get-SPWeb http://siteURL -AssignmentCollection $spAssignment

$SPWeb.ListTemplates | Select Name, Description

$SPTemplate = $SPWeb.ListTemplates["Custom List"]

$SPWeb.Lists.Add("List Title","Description",$SPTemplate)

If you have any queries/questions regarding the above mentioned information then please let me know, Thank you.

1 comment:

  1. Thank you Amol for this wonderful article! it helps me to resolve one of the requirements that was arises dynamically!

    keep posting such good articles....

    ReplyDelete

Your feedback is always appreciated. I will try to reply to your queries as soon as possible- Amol Ghuge

Note: Only a member of this blog may post a comment.