Scenario/Problem: You need to configure a new SharePoint farm from the command line.
Solution: Use the New-SharePointFarm
cmdlet from the SPModule
.
The New-SharePointFarm
cmdlet enables you to configure a new SharePoint farm on the server. The syntax follows:
New-SharePointFarm -databaseserver <server name>
-databaseaccessaccount (Get-Credential <domainaccount>)
-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 prompts you for the password of the database access account entered, as in Figure 3.2.
After you enter the credentials, the new farm is configured using the database server entered. This essentially creates the SharePoint_Config
database and prepares the farm for use.
Note
The farm passphrase is a password that is used when you are adding new servers to the farm or making farm configuration changes. It needs to be entered into the cmdlet as a secure string; therefore, the ConvertTo-SecureString
cmdlet is also used in conjunction with New_SharePointFarm
.
18.118.1.232