Posts Tagged ‘New-SPWebApplication’

Some Nice PowerShell Scripts for Configuring a SharePoint 2010 Farm

Written by Denis Stadler on . Posted in IT Pro & PowerShell

The main idea behind this post is the wish of getting a configured SharePoint farm which has friendly and standardized names for the databases created during the configuration process.

Below I will post only the PowerShell scripts that I used to provision the services that don’t offer the possibility of configuring the database name(s).

If you are searching a fully automated SharePoint installation solution, please check AutoSPInstaller on CodePlex.

Central Administration Provisioning

The following script provisions the central administration. Run it on the first SharePoint server within your farm, on the server that is going to host the Central Administration web application.


SharePoint 2010 Administration PowerShell Sheet

Written by Denis Stadler on . Posted in IT Pro & PowerShell, SharePoint 2010

There are 652 SharePoint Server 2010 PowerShell cmdlets. Please find bellow a short list with the ones that I use.

Before starting please verify that you meet the following minimum requirements:
1. Your user account is a member of the SharePoint_Shell_Access role on the configuration database.
2. Your user account is a member of the WSS_ADMIN_WPG local group on the computer where SharePoint Server 2010 is installed.

Please open SharePoint Server 2010 Management Shell. To acomplish this please follow the steps:
1. On the Start menu, click All Programs.
2. Click Microsoft SharePoint Server 2010 Products.
3. Click SharePoint Server 2010 Management Shell.

Application Management

Web Applications

To create a new Web Application using PowerShell just use:

New-SPWebApplication -Name <Name> -ApplicationPool <ApplicationPool> -ApplicationPoolAccount <ApplicationPoolAccount> -Port <Port> -URL <URL>

Create a Site Collection

To create a new Site Collection using PowerShell first you have to chose a template. To do that just use the following command to list all the templates available within SharePoint:


Then replace <template-name> with your selected template and use the following command to create the site collection:

$template = Get-SPWebTemplate <template-name>
-Url <URL for the new site collection>-OwnerAlias <domain\user> -Template $template