Configure a New SharePoint Farm
Solution: Use the New-SharePointFarm cmdlet from the SPModule.
The New-SharePointFarm cmdlet allows you to configure a new SharePoint farm on the server. The syntax is as follows:
New-SharePointFarm -databaseserver <server name> -databaseaccessaccount (Get-Credential <domain\account>) -farmname <name of new farm> -passphrase (ConvertTo-SecureString -asplaintext -force -string "Enter a farm pass phrase here")
This command requires credentials for the database server. Therefore, the Get-Credential PowerShell command is used in conjunction with New-SharePointFarm. After you enter the command, PowerShell will prompt for the password of the database access account entered, as shown in Figure 3.2.
Figure 3.2 Using Get-Credential prompts for the corresponding password.
Once the credentials have been entered, the new farm will be configured using the database server entered. This essentially creates the SharePoint_Config database and prepares the farm for use.