Refresh Installed Products
Scenario/Problem: You need to ensure that the SharePoint products installed on a farm server are properly registered.
Solution: Use the Set-SPFarmConfig cmdlet with the InstalledProductsRefresh switch parameter.
Using the InstalledProductsRefresh switch parameter with the Set-SPFarmConfig cmdlet refreshes the current server’s license state with the products installed on the SharePoint farm. Listing 1 shows a sample command line.
Listing 1. Refreshing the Installed Products
Set-SPFarmConfig -InstalledProductsRefresh
Change the Port of Central Admin
Scenario/Problem: You want to change the HTTP port value for Central Administration.
Solution: Use the Set-SPCentralAdministration cmdlet with the Port parameter.
The Set-SPCentralAdministration
cmdlet is used solely to change the port number configured for the
Central Administration web application. Provide a valid port number, as
shown in Listing 2.
Listing 2. Changing the Port of Central Admin
Set-SPCentralAdministration -Port 20222
Change the Farm Passphrase
Scenario/Problem: You want to change the farm passphrase.
Solution: Use the Set-SPPassPhrase cmdlet with the PassPhrase parameter.
The Set-SPPassPhrase
cmdlet is used solely to change the SharePoint farm passphrase. This
passphrase was initially entered during the installation of the
SharePoint farm. Provide a secure string value with the PassPhrase parameter, as shown in Listing 3.
Listing 3. Changing the Farm Passphrase
Set-SPPassPhrase -PassPhrase (ConvertTo-SecureString -asplaintext
-force -string "SharePoint1")
For scripting purposes, if you do not want to be prompted to confirm the passphrase entry, include the ConfirmPassPhrase parameter and switch off the general confirmation, as shown in Listing 4.6.
Listing 4.6. Changing the Farm Passphrase Without Prompts
Set-SPPassPhrase -PassPhrase (ConvertTo-SecureString -asplaintext
-force -string "SharePoint1") -ConfirmPassPhrase
(ConvertTo-SecureString -asplaintext -force -string "SharePoint1")
-Confirm:$false
Tip
The default operation performs the passphrase modification for the entire farm. If you run into issues, use the LocalServerOnly
switch parameter to perform the modification on only the current
server. Continue on each server in the farm to pinpoint the problem.