Sunday, January 24, 2021

PowerShell script for creating site collection in Sharepoint

In this blog post we will know how to create new site collection in sharepoint (this applies for 2010,2013, 2016, 2019) using power shell scripts. Again we can create site collection using UI as well but here we will use PowerShell.

Note: Before going through the please go through my first post in power shell series which convers how to use PS scripts.

Below is the standard template we will use while creating the site collection, we can replace it with custom values as per the requirement.

New-SPSite –Url <URL of the site collection>
-Name <Site collection name>
-OwnerAlias <Site collection administrator>
-Template <In which template site needs to be created like blog, team etc>
Here we are creating team site collection with with SPAdmin as the owner.

New-SPSite "http://blogpost/sites/test" -OwnerAlias "blogpost\spadmin" -Language 1033 -Template STS#0

No comments:

Post a Comment