Partager via


Configure SharePoint 2013 Farm with PowerShell

A little PowerShell script that I often use while setting up my demo environments. There is more addition to this coming…

For sake of sanity… there is a zip file attached to this post with the ps1 file in it.

 

Clear-Host

# Values mentioned below needs to be edited

 $DatabaseServer = "SQL01"; #SPecify the instance name if SQL is not installed on default instance

$FarmName = "SP2013";

$ConfigDB = $FarmName+"_ConfigDB";

$AdminContentDB = $FarmName+"_CentralAdminContent";

$Passphrase = convertto-securestring "pass@word1" -asplaintext -force;

$Port = "2013";

$Authentication = "NTLM";

$FarmAccount = "waterfall\spfarm"

##########################################################################

############################### DO NOT EDIT ANYTHING BELOW THIS LINE #####

##########################################################################

#Start Loading SharePoint Snap-in

$snapin = (Get-PSSnapin -name Microsoft.SharePoint.PowerShell -EA SilentlyContinue)

IF ($snapin -ne $null){write-host -f Green "SharePoint Snapin is loaded... No Action taken"}

ELSE {

write-host -f Yellow "SharePoint Snapin not found... Loading now"

Add-PSSnapin Microsoft.SharePoint.PowerShell

write-host -f Green "SharePoint Snapin is now loaded"}

# END Loading SharePoint Snapin

# checking to see if SharePoint Binaries are installed

IF((Get-WmiObject -Class Win32_Product | Where {$_.Name -eq "Microsoft SharePoint Server 2013 "}) -ne $null)

{"Found SharePoint Server 2013 Binaries. Will create Farm now"

New-SPConfigurationDatabase -DatabaseName $ConfigDB -DatabaseServer $DatabaseServer -FarmCredentials (Get-Credential $farmAccount) -Passphrase $Passphrase -AdministrationContentDatabaseName $AdminContentDB

Remove-PSSnapin Microsoft.SharePoint.PowerShell

Add-PSSnapin Microsoft.SharePoint.PowerShell

Install-SPHelpCollection -All

"Installed Help Collection"

Initialize-SPResourceSecurity

"Initialized SP Resource Security"

Install-SPService

"Instaled Ssp service"

Install-SPFeature -AllExistingFeatures

"Installed SP Feature"

New-SPCentralAdministration -Port $Port

"Created Central Administration Site"

Install-SPApplicationContent

"Installed Application Content. This was the last step.

Farm Configuration Complete!"

}

ELSE {"SP Binaries not found"}

  

This posting is provided "AS IS" with no warranties, and confers no rights.

Create SP Farm-Blog.zip

Comments

  • Anonymous
    May 23, 2014
    Lovely Script. You saved my day

  • Anonymous
    March 12, 2015
    Nice Article! thanks

  • Anonymous
    September 23, 2015
    Nice Article! thanks , Good Script..