A few months ago I did a small guide about starting up a SharePoint 2013 farm by using only PowerShell. There are several reasons why I prefer this approach instead of the available “SharePoint 2013 Products Configuration Wizard”. The wizard is fine but if you do not have a dedicated instance for your SharePoint installation it brings too many problems instead of solving. Also having a script as a reference which can also be used on other nodes/farms with minimal adjustments is an added bonus.
I recently paid a subscription to Pluralsight and they have a dedicated training for setting up a farm with PowerShell, well this training takes the same approach I did in my old post but it is far from being perfect.
After researching I found that the same wizard can be used using psconfig.exe with a lot of switches. This is the TechNet reference if you need to adjust the script I will provide.
Here is the PowerShell script you can use to setup a new farm, specify the farm admin, a passphrase, create the Central Administration and the config DB’s, installs all services, installs all features, provisions a new Central Administration Web Application with NTLM authentication.
psconfig.exe -cmd configdb -create -server SERVERNAME\INSTANCE_NAME -database CONFIG_DB_NAME -passphrase “YOUR PASSPHRASE” -user DOMAIN\FARM_ACCOUNT -password FARM_ADMIN_PASSWORD -admincontentdatabase CENTRAL_ADMIN_DB_NAME -cmd helpcollections -installall -cmd secureresources -cmd services -install -cmd installfeatures -cmd adminvs -provision -port YOUR_PORT -windowsauthprovider onlyusentlm -cmd applicationcontent -install
Save the above script(psconfig should be on one row with all the switches) and make modifications based on your needs. This will be used only on the first server of the farm, on the other nodes you will need to use the [-connect] switch with the configdb option like here:
psconfig.exe -cmd configdb -connect -server <Server_name> -database <Database_name>
-dbuser <DOMAIN\username> -dbpassword <password>
-dbuser can be used to specify an account with SQL database access in case the account you use to setup has no privileges on the SharePoint SQL databases/SQL instance.