Implementing a Scripted Deployment for SharePoint 2013

The process of installing and configuring a SharePoint 2013 can be broken down into three major segments:

  1. Prerequisite and binaries installation (optional)
  2. Farm creation along with central administration and core features
  3. Service Application installation and configuration.

In this post we will do what the Configuration Wizard does in the Farm creation via powershell. The configuration wizard carries out several taks:

  • Create the Configuration Database
  • Sets the Farm Pass Phrase
  • Create the Farm
  • Create the Central Administration Web Application
  • Perform the config wizard tasks

And, since we are using a script installation, we should add the following tasks as part of recommended practices:

  • Create a SQL Alias
  • Set the Max Degree of Parallelism

Set variables and parameters

#Add the Powershell Snapin for SharePoint

Add-PSSnapin Microsoft.Sharepoint.Powershell

#Prompt for the Pass Phrase

$PassPhrase = Read-Host –AsSecureString "SP Pass Phrase"

#Prompt for Farm Admin password

$FarmAdminAccount="DOMAINSP_FarmAdmin"

$FarmCredentials = Get-Credential –credential $FarmAdminAccount

#Farm Configuration Parameters

$DBServer = $AliasName

$AdminContentDB = "WSS_Content CentralAdmin"

$SPConfigDB = "SharePoint_Config"

$CAPort="45077"

$CAWindowsAuthProvider="NTLM"

#Create Configuration Database

New-SPConfigurationDatabase –DatabaseName $SPConfigDB –DatabaseServer $DBServer –AdministrationContentDatabaseName $AdminContentDB –FarmCredentials $FarmCredentials –PassPhrase $PassPhrase

#Create Central Administration Web App

New-SPCentralAdministration –Port $CAPort –WindowsAuthProvider $CAWindowsAuthProvider

#Install the Help Site Collection Files in the current Farm

Install-SPHelpCollection –All

#Enforce Resource Security on the Local Server

Initialize-SPResourceSecurity

#Install and Provision Services on the Farm

Install-SPService

#Install Features from the Feature.xml file

Install-SPFeature –AllExistingFeatures

#Copy Shared Application Data to Existing Web Application Folders

Install-SPApplicationContent

$AliasName = "70331SQL"

$SQLName= "SQLServerInstanceName"

$PortServer=1433

$ServerName=$SQLName+","+$PortServer

#Registry SQL Alias locations

$x86 = "HKLM:SoftwareMicrosoftMSSQLServerClientConnectTo"

$x64 = "HKLM:SoftwareWow6432NodeMicrosoftMSSQLServerClientConnectTo"

#Test if the ConnectTo key already exists, and create it if it doesn´t

if ((test-path -path $x86) -ne $True)

{

write-host "$x86 doesn't exist"

New-Item $x86

}

if ((test-path -path $x64) -ne $True)

{

write-host "$x64 doesn't exist"

New-Item $x64

}

#Adding the extra "fluff" to tell the machine what type of alias it is

$TCPAlias = "DBMSSOCN," + $ServerName

$NamedPipesAlias = "DBNMPNTW,\" + $ServerName + "pipesqlquery"

#Creating our TCP/IP Aliases

New-ItemProperty -Path $x86 -Name $AliasName -PropertyType String -Value $TCPAlias

New-ItemProperty -Path $x64 -Name $AliasName -PropertyType String -Value $TCPAlias
Advertisements

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