How to Create SharePoint 2016 Farm using PowerShell?

Creating SharePoint 2016 farm using PowerShell is almost as same as in its previous version. In SharePoint 2016 there is an additional parameter -LocalServerRole added as SharePoint 2016 introduced MinRoles.


  • SQL Server is already installed and ready to use.
  • You have created a Farm account for SharePoint 2016.
  • You have logged in to the server (Setup account) which has Administrator access on all SharePoint servers and DB_Creator, Security_Admin Server roles in SQL Server.

Step 1: Install SharePoint 2016 prerequisites and binaries to each server in your proposed SharePoint 2016 farm.

install sharepoint 2016 farm using powershell

On completing the installation, Uncheck “Run the SharePoint Products Configuration Wizard now” and close the wizard.

create new sharepoint 2016 farm with Powershell

Step 2: PowerShell Script to Create SharePoint 2016 Farm:

Save the below script as “Create-Farm.ps1” or something like that, change the configuration settings parameters as per your environment. Open SharePoint 2016 Management Shell as Administrator, and run the script. You’ll see “The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.” error for the first time, which is quite normal, since we have not created the farm yet! Proceed running the script.

#Configuration Settings 
$DatabaseServer = "SP16-SQL"
$ConfigDatabase = "Intranet_Farm_Config"
$AdminContentDB = "Intranet_Farm_Content_Admin"
$Passphrase = "2FJlsXghFsas5vdJJKEXXwWF"
$FarmAccountName = "Crescent\Sp2016admin"

#Get the Farm Account Credentials
$FarmAccount = Get-Credential $FarmAccountName
$Passphrase = (ConvertTo-SecureString $Passphrase -AsPlainText -force)
#Create SharePoint Farm
Write-Host "Creating Configuration Database and Central Admin Content Database..."
New-SPConfigurationDatabase -DatabaseServer $DatabaseServer -DatabaseName $ConfigDatabase -AdministrationContentDatabaseName $AdminContentDB -Passphrase $Passphrase -FarmCredentials $FarmAccount -LocalServerRole $ServerRole

$Farm = Get-SPFarm -ErrorAction SilentlyContinue -ErrorVariable err  
if ($Farm -ne $null) 
Write-Host "Installing SharePoint Resources..."
Write-Host "Installing Farm Services ..."
Write-Host "Installing SharePoint Features..."
Install-SPFeature -AllExistingFeatures
Write-Host "Creating Central Administration..."              
New-SPCentralAdministration -Port 2016 -WindowsAuthProvider NTLM
Write-Host "Installing Help..."
Install-SPHelpCollection -All  
Write-Host "Installing Application Content..."
Write-Host "SharePoint 2016 Farm Created Successfully!"

Once the script completed successfully, You’ll see farm created successfully message. Here I’ve used “SingleServer” as MinRole. You can adjust it based on your requirement.

Alternatively, You can create SharePoint Farm (Run script til line#15) and then Run Products configuration wizard to complete the rest of the steps in farm creation.

Add Additional Servers to the SharePoint 2016 Farm:
Once you are done with the creation of the SharePoint 2016 farm from the first server, You can connect the rest of the servers to the farm either using the SharePoint products configuration wizard or with PowerShell.

Open SharePoint products configuration wizard and choose “Connect to an existing server farm” and run through the wizard! Select the server MinRole as per your topology.

powershell script to create sharepoint 2016 farm

Join Additional Server to the SharePoint 2016 farm using PowerShell:
If you prefer the PowerShell way to add an additional server to the farm, use this PowerShell script.  


Connect-SPConfigurationDatabase -DatabaseServer $DBServer -DatabaseName $DBName -PassPhrase $Passphrase -LocalServerRole $ServerRole
Write-Host "Installing SharePoint Resources..."
Write-Host "Installing Farm Services ..."
Write-Host "Installing SharePoint Features..."
Install-SPFeature -AllExistingFeatures
Write-Host "Installing Help..."
Install-SPHelpCollection -All  
Write-Host "Installing Application Content..."
Write-Host "Joined the Server to Farm Successfully!"
If you don’t want the server to host Distributed cache, use the parameter: -SkipRegisterAsDistributedCacheHost and the end!

Related post: How to Create SharePoint 2013 farm using PowerShell

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

11 thoughts on “How to Create SharePoint 2016 Farm using PowerShell?

  • May 28, 2020 at 12:52 PM

    Hi Salaudeen – 1) Is this the same for installing SharePoint 2019 & 2) Do you run the script from the folder containing the SharePoint setup/binaries files?

  • March 31, 2020 at 5:53 PM

    I have a question: does the farm config steps’ order matter ? I mean, you followed the following order in your script :

    Initialize-SPResourceSecurity > Install-SPService > Install-SPFeature > New-SPCentralAdministration > Install-SPHelpCollection > Install-SPApplicationContent

    But I found other articles/scripts doing the same but with different order as follows :

    Install-SPHelpCollection > Initialize-SPResourceSecurity > Install-SPService > Install-SPFeature > New-SPCentralAdministration > Install-SPApplicationContent

    so ?

  • March 20, 2019 at 9:47 AM

    Thanks for your useful post. I may did a mistake running your script… I was logged in as SP_Admin (because the only local Admin and RDP user for this machine) and ran your script. I named the user SP_Farm as Farm Account Name. The config itself was successfull and I can access the Central Administration partyl with the SP_Farm account. But I cannot do the most settings. Either they are greyed out or I get “Sorry, this page was not shared with you yet”. The SP_Admin user can do everything I want…
    I see the SP_Farm account as member in farm administrators group. Where’s the fault? I don’t get it…

    • March 20, 2019 at 10:34 AM

      Disable Internet Explorer Enhanced Security and Add a Full control Policy to your SP_Admin Account!

  • February 14, 2018 at 5:27 PM

    I ran the script and get cannot bind parameter ‘passphrase’ cannot convert the value of type system.string to type system secure string? the under Get-farm a positional parameter cannot be found that accepts argument if?

  • January 11, 2018 at 3:10 PM

    Tnx alot for useful post

  • December 19, 2017 at 4:48 PM

    I don’t find the Custom Ribbon on the top in the Central Admin screen ? what could be the issue?Please advise

  • November 5, 2017 at 2:27 PM

    Thank you so much for sharing this script. Its pretty clean and neat, I’m able to pickup although I’m new to SharePoint. Kudos.

  • October 8, 2017 at 6:44 AM

    Great Work you do man. Very much appreciate it 🙂


Leave a Reply