Overview

At first glance, you may think that installing SharePoint from the GUI is your best approach, as it is very easy and just about anyone can click through the wizard. The problem with this type of install is that you do not have the flexibility to name your configuration database the way you want. By choosing the wizard based approach, you will receive a GUID inside your database name. PowerShell has a number of commands that help make this a simple process. This article will walk you through the cmdlets responsible, describe what each of them do, and then give you a working example. All we are doing here is creating the configuration and administration databases.

Once you have the farm provisioned we will move on to the configuration aspects which will include the services, applications, etc.

The Cmdlets

There are seven cmdlets that you will need to provision your farm so that you can access it correctly. The cmdlets are listed below along with their descriptions provided by the Get-Help cmdlet.

New-SPConfigurationDatabase

The New-SPConfigurationDatabase cmdlet creates a new configuration database on the specified database server. This is the central database for a new SharePoint farm.

Install-SPHelpCollection

The Install-SPHelpCollection cmdlet installs the Help site collection files for SharePoint 2010 Products in the current farm. Use the LiteralPath parameter to install specific custom Help collection files. If the LiteralPath parameter is not specified, all available Help in the Help site collection is installed and existing Help collection files are overwritten.

Initialize-SPResourceSecurity

The Initialize-SPResourceSecurity cmdlet enforces resource security on the local server. This cmdlet enforces security for all resources, including files, folders, and registry keys.

Install-SPService

The Install-SPService cmdlet installs and optionally provisions services on a farm. This cmdlet installs all services, service instances, and service proxies specified in the registry on the local server computer. Use this cmdlet in a script that you build to install and deploy a SharePoint farm or to install a custom developed service.

Install-SPFeature

The Install-SPFeature cmdlet installs a specific SPFeature object by providing in the Identity parameter the relative path from the folder “$env:ProgramFilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATEFEATURES to the feature. The SharePoint Feature’s files must already be put in the proper directory, either manually or by using a solution installer.

If the AllExistingFeatures parameter is provided, the file system is scanned and any new features are installed. This is generally only used during deployment and upgrade.

New-SPCentralAdministration

The New-SPCentralAdministration cmdlet creates a new Central Administration Web application and starts the central administration service on the local machine. Central Administration is available only on computers where this service runs.

Install-SPApplicationContent

The Install-SPApplicationContent cmdlet copies shared application data to existing Web application folders. This cmdlet does not take any parameters.

The Script

 

# Create a new SharePoint Configuration and Administration database, use “pass@word” as the passphrase.

New-SPConfigurationDatabase –DatabaseName “PS4SP_SP2010_Config” –DatabaseServer “<Your DB Server>” –AdministrationContentDatabaseName “SharePoint2010_Admin_Content” –Passphrase (ConvertTo-SecureString “pass@word1” –AsPlaintext –Force) –FarmCredentials (Get-Credential)

# Installs the Help site collection files for SharePoint 2010 Products in the current farm

Install-SPHelpCollection –All

# Enforces resource security on the local server

Initialize-SPResourceSecurity

# Installs services on a farm

Install-SPService

# The file system is scanned and any new features are installed

Install-SPFeature –AllExistingFeatures

# Creates a new Central Administration Web application and starts the central administration service on the local machine

New-SPCentralAdministration -Port 11030  -WindowsAuthProvider “NTLM”

# Copies shared application data to existing Web application folders

Install-SPApplicationContent

Advertisements

2 thoughts on “Provisioning SharePoint 2010 with PowerShell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s