1. Install Without a Product Key in the Configuration File
For security purposes, you might not want to store the product key within the configuration file. Instead, you can use the -PIDKey
parameter, followed by your product key in quotes on the command line with the Install-SharePoint
cmdlet, as in Listing 1.
Listing 1. Installing SharePoint from the Command Line with a Product Key
Install-SharePoint -setupexepath D:\setup.exe -configxmlpath
c:\config.xml -PIDKey "ABDCE-FGHIJ-KLMNO-PQRST-UVWXY"
2. Configure a New SharePoint Farm
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 <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 prompts you for the password of the database access account entered, as in Figure 1.
Figure 1. Using Get-Credential prompts for the corresponding password.
Tip
Use inline credentials instead of (Get-Credential)
.
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
.