Power Shell is one outstanding tool for managing and configuring SharePoint 2010 without using the web GUI. A good use of Power Shell is creating CMDLets to automate the process of provisioning sites and site collections. In today’s walkthrough we will create a new web application and a site collection using Power Shell without accessing SharePoint 2010 Central Administration site.
So let’s start by launching SharePoint 2010 Management Shell under Start –> All Programs –> SharePoint 2010 Products. Make sure to run the Management Shell as an Administrator.
To create a new web application we use the New-SPWebApplication command. The best thing about Power Shell commands is that you don’t need to specify the parameters when calling the command, it will ask you for each parameter . If you remember back in STSADM (MOSS), we did not have that luxury! Below we are creating a web application called SharePointStack.
As you can see from the screenshot above, I used the following parameters:
You can use Get-Help New-SPWebApplication command to get more information about the command parameters.
Now let’s go and create the site collection using the New-SPSite command. This time I am not going to specify the parameters. The command will ask me for the parameters.
If you don’t specify the Template parameter, the user will have the chance to set the site template on the first request.
I chose the Blank Site template.
If you want to set the template when creating the site, you can add the Template parameter. To get a list of the templates installed, you can use the Get-SPWebTemplate command. For example, the Blank Site template parameter is: STS#1.
You can use Get-Help New-SPSite command to get more information about the command parameters.
Well that’s about it