<#====================================================================
Copyright © 2015, June. Michael Pomfret
Connect to an existing Server Farm
You should replace the “<Server name>” with the correct windows server name.
You should replace the “<SharePoint Configuration DB>” with the correct SharePoint Configuration database name.
You should replace the “<YourPassPhase>” with the correct passphase.
====================================================================#>
cls
Write-Host “SharePoint 2013 – Connect to an existing Server Farm…”
$DBServer = ‘<Server name>’
$ConfigDB = ‘<SharePoint Configuration DB>’
$PassPhrase = ‘<YourPassPhase>’
$SecPassPhrase = ConvertTo-SecureString $PassPhrase –AsPlaintext –Force
Write-Host ” – Enabling SP PowerShell cmdlets…”
If ((Get-PsSnapin |?{$_.Name -eq “Microsoft.SharePoint.PowerShell”})-eq $null)
{
Add-PsSnapin Microsoft.SharePoint.PowerShell | Out-Null
}
Start-SPAssignment -Global | Out-Null
Write-Host ” – Connecting to server farm…”
Connect-SPConfigurationDatabase -DatabaseServer $DBServer -DatabaseName $ConfigDB -Passphrase $SecPassPhrase
Write-Host ” – Installing Help Collection…”
Install-SPHelpCollection -All
Write-Host ” – Securing Resources…”
Initialize-SPResourceSecurity
Write-Host ” – Installing Services…”
Install-SPService
Write-Host ” – Installing Features…”
$Features = Install-SPFeature –AllExistingFeatures -Force
Write-Host ” – Installing Application Content…”
Install-SPApplicationContent
Stop-SPAssignment -Global | Out-Null