PowerShell cmdlets always help administrator to manage the SharePoint farms. SharePoint 2016 add another command in this list, which helpadmins to manage the central admin web app.
With these commands, we can do many things using these commands which are not available via central admin. We can set the new passphrase, remove the central admin web app, set the global farm settings.

Here is the list of all available farm cmdlets, I will briefly explain each of the commands.

  • Get-SPFarmConfig
  • Get-SPProcessAccount
  • Get-SPWebTemplate
  • New-SPCentralAdministration
  • Remove-SPCentralAdministration
  • Set-SPCentralAdministration
  • Set-SPFarmConfig
  • Set-SPPassPhrase
  • Start-SPAdminJob

Get-SPFarmConfig

If we want to retrieve the farm wide settings then we need this powershell. The Get-SPFarmConfig cmdlet retrieves global settings for the local farm that are not members of the SPFarm object. This cmdlet creates a new PSCustomObject object from the collection of properties returned from the local farm, and then adds this object to the pipeline. The PSCustomObject object can be read, or modified and passed to the Set-SPFarmConfig cmdlet to change parameter values.

Parameter

  • ServiceConnectionPoint (Optional, System.Management.Automation.SwitchParameter): Gets the information stored in the current farm's service connection point in Active Directory.
  • AssignmentCollection (Optional,Microsoft.SharePoint.PowerShell.SPAssignmentCollection)Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

    • NoteNote:When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Example


Get-SPFarmConfig
This example returns the settings of all global properties, like this


Get-SPProcessAccount

The Get-SPProcessAccount cmdlet returns a system account or a managed account and creates the SPProcessAccountPipeBind object. All operations that can accept an account can accept the SPProcessAccountPipeBind in place of the SPManagedAccountPipeBind.

Parameter

  • Confirm (Optional,System.Management.Automation.SwitchParameter):Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters
  • LocalService(Optional,System.Management.Automation.SwitchParameter):Returns the LocalService account.
  • LocalSystem(Optional,System.Management.Automation.SwitchParameter):Returns the LocalSystem account.
  • NetworkService(Optional,System.Management.Automation.SwitchParameter):Returns the NetworkService account.

Example

Get-SPProcessAccount

This example returns all system and Managed accounts.

Get-SPProcessAccount -NetworkService

This example creates the SPProcessAccountPipeBind type by using the NetworkService account.

Get-SPProcessAccount -LocalSystem

This example creates the SPProcessAccountPipeBind type by using the LocalSystem account.

Get-SPProcessAccount -LocalService

This example creates the SPProcessAccountPipeBind type by using the LocalService account.

Get-SPWebTemplate

Sometimes, we want to the information of about a single template or want to get the list of all available templates. The Get-SPWebTemplate cmdlet displays all installed site templates that match the full or partial identity that was given.

Parameter

  • Identity (Optional,Microsoft.SharePoint.PowerShell.SPWebApplicationPipeBind): Specifies the name of the Web template to display.The type must be the ID or full or partial name of the Web template.
  • CompatibilityLevel(Optional, System.UInt32): Specifies the version of templates to use when creating a new SPSite object. This value sets the initial CompatibilityLevel value for the site collection. The values for this parameter can be either SharePoint Server 2010 or SharePoint Server 2013. When this parameter is not specified, the CompatibilityLevel will default to the highest possible version for the Web application depending on the SiteCreationMode setting

Example

Get-SPWebTemplate

This example displays all globally available templates( for all languages, compatibility level).

Get-SPWebTemplate "STS*"

This example displays basic information about all the STS templates.

Get-SPWebTemplate "STS#0" | select *

This example displays detailed information about all the STS templates.


New-SPCentralAdministration


If you want to create a Central Admin on additional server in the farm, then you have to run this command on server. The New-SPCentralAdministration cmdlet creates a Central Administration web site on the local server. If you run this command on a server where there is already a Central Administration web site, this command will effectively change the port number.

Parameter

  • Port (Optional,System.Int32):Specifies the port number for Central Administration. If no port is specified, a non-conflicting port number is auto-generated.The type must be a valid port number.
    • Important:If you specify a port number that has already been assigned, IIS does not start the new site until you change either the port number of the new site or the port number of the old site.
  • SecureSocketsLayer(Optional,System.Management.Automation.SwitchParameter):Enables Secure Socket Layer (SSL) encryption for the specified port. If you choose to use SSL, you must assign a server certificate to the Central Administration IIS web site by using the IIS administration tools. The Central Administration web application won't be accessible until you do this.The default value is False.
    • NoteNote:If this parameter is omitted or set to False the Central Administration site will use HTTP for the specified port.
  • WindowsAuthProvider(Optional,System.String):Specifies the authorization provider for this Web application. If no authentication provider is specified, the default value NTLM is used. The type must be one of two values: Kerberos, or NTLM.

Example

New-SPCentralAdministration
This example will create the central admin web on the local Server, on a randomly pick non-used port along with NTLM authentication.

New-SPCentralAdministration​ -port 1243
This example will create the central admin web on the local Server at port # 1243 along with NTLM authentication.

New-SPCentralAdministration​ -port 1243 -WindowsAuthProvider NTLM -
SecureSocketsLayer
This example will create the central admin web on the local Server at port # 1243 with NTLM authentication and SSL. Now we need to do extra steps to configure the SSL at IIS level.

Remove-SPCentralAdministration

SharePoint 2016 brings this new fantastic command, which now allow administrator to remove a central admin web application from a server. Remove-SPCentralAdministration commdlets Removes the SharePoint Central Administration web site from the local server.

Parameter


  • AssignmentCollection (Optional,Microsoft.SharePoint.PowerShell.SPAssignmentCollection)Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
    NoteNote:When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.
  • Confirm (Optional,System.Management.Automation.SwitchParameter): Prompts you for confirmation before executing the command. For more information

Example


Remove-SPCentralAdministration
This example removes the Central Administration web site from the local server.Make sure run the command on correct server, it will remove it from local server not remote.

Set-SPCentralAdministration

The Set-SPCentralAdministration cmdlet sets the port for the Central Administration web site. This affects all servers that are running the Central administration web site in the farm.

Parameter

  • Port (Optional,System.Int32):Specifies the port number for Central Administration. If no port is specified, a non-conflicting port number is auto-generated.The type must be a valid port number.
    • Important:If you specify a port number that has already been assigned, IIS does not start the new site until you change either the port number of the new site or the port number of the old site.
  • SecureSocketsLayer(Optional,System.Management.Automation.SwitchParameter):Enables Secure Socket Layer (SSL) encryption for the specified port. If you choose to use SSL, you must assign a server certificate to the Central Administration IIS web site by using the IIS administration tools. The Central Administration web application won't be accessible until you do this.The default value is False.
    • NoteNote:If this parameter is omitted or set to False the Central Administration site will use HTTP for the specified port.
  • Confirm(Optional,System.Management.Automation.SwitchParameter):Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

Example


Set-SPCentralAdministration -Port 2500
This example will set the port number for the central administration on all servers in the farm( if CA provisioned on all servers).

Set-SPCentralAdministration -Port 2500 -SecureSocketsLayer
This example will set the port number for the central administration on all servers in the farm( if CA provisioned on all servers) and also configure the SSL.

Set-SPFarmConfig


In many cases, we want to set the global property of local farm, this is not possible using the SharePoint Central Admin. For this we have the SharePoint power shell command.
The Set-SPFarmConfig cmdlet updates a collection of global settings for the local farm that are not members of the SPFarm object. Use the Get-SPFarmConfig cmdlet to read global settings for the local farm and to create a new PSCustomObject object from the collection of properties returned from the local farm, and then add this object to the pipeline. Modify the PSCustomObject object and pass it to the Set-SPFarmConfig cmdlet to change the parameter values.
The properties collected in the PSCustomObject object must be farm-wide settings, and must be configurable only once for the entire farm. The parameter name added to the PSCustomObject object must match exactly the input parameter name for the Set-SPFarmConfig cmdlet.

Parameter

  • ASPScriptOptimizationEnabled(Optional,System.Boolean): Specifies if ASP Script optimization is enabled. The default value is false (off).
  • AssignmentCollection(Optional,Microsoft.SharePoint.PowerShell.SPAssignmentCollection):
  • Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
    • NoteNote: When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.
  • Confirm(Optional,System.Management.Automation.SwitchParameter):Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters
  • DataFormWebPartAutoRefreshEnabled(Optional,System.Boolean):Specifies whether any DataFormWebPart on any page in this farm is allowed to periodically refresh its contents asynchronously (after the page has finished rendering). When set to false, all DataFormWebParts will ignore the automatic refresh interval provided in Web Part properties.
  • DefaultActivateOnSiteMasterValue(Optional,System.Boolean):Specifies whether to activate site master as default.
  • Force(Optional,System.Management.Automation.SwitchParameter):Forces the deletion or updating of the service connection point.
  • InstalledProductsRefresh(Optional,System.Management.Automation.SwitchParameter):Updates the current machine license state with the list of products that are installed in the farm.
  • MaxSiteSubscriptionSettingsValueLength(Optional,System.UInt32):
  • MaxTenantStoreValueLength(Optional,System.UInt32):
  • ServiceConnectionPointBindingInformation(Optional,System.String):Adds or updates the service connection point for the current farm in Active Directory Domain Service (AD  DS). The type must be an array of strings that are key value pairs that will be added to the service connection point.
  • ServiceConnectionPointDelete(Optional,System.Management.Automation.SwitchParameter):Delete the service connection point for the current farm in AD DS.
  • SiteMasterMode(Optional,Microsoft.SharePoint.Administration.SPSiteMasterMode):Specifies if site master mode is turned on or off. The default value is off.
  • SiteMasterValidationIntervalInHours(Optional,System.UInt32):
  • UserAccountDirectoryPathIsImmutable(Optional,System.Management.Automation.SwitchParameter):
  • WorkflowBatchSize(Optional,System.Int32):Specifies the paging size for events delivered to a single workflow instance. For each request, the events are streamed out 100 at a time.
    Batch size is the number of events processed for a single workflow instance, which can have many events queued at the same time. Throttle will override batch size; if the workflow instance cannot be started or restarted because there are too many instances running across all front-end Web servers, none of the events will be fetched, regardless of the batch size.
  • WorkflowEventDeliveryTimeout(Optional,System.Int32):Specifies the time as an integer in which a workflow job must run without the job timing out. If the workflow job does time out, it gets put back in the queue to be run again.
    For example, if the value is set to 5, the workflow job must run within 5 minutes are the workflow job will time out. Any workflow job that does time out is placed back in the queue to run again. The default value is 5.
  • WorkflowPostponeThreshold(Optional,System.Int32):Specifies the number of workflows that can be running in IIS against a content database at a time before new workflow instances get postponed into a queue.

Example


$fc = Get-SPFarmConfig
$fc.WorkflowBatchSize = 200
$fc | Set-SPFarmConfig
$fc | Select WorkflowBatchSize | Format-List

This example will set the workflowBatchSize value to 200. output will be likely this:

Set-SPPassPhrase

Sometimes, we lost the passphrase which is an important thing. if you want to add a new server into the farm then you need this passPhrase to join it. The bad thing about passphrase you cannot retrieve it, the only option is to change it.The Set-SPPassPhrase cmdlet sets the Passphrase to a new Passphrase value. If the LocalServerOnly parameter is not used, the farm encryption key is re-encrypted with the new value and attempts to propagate this value to all other servers in the farm. If the LocalServerOnly parameter is used, this is updated on the local machine only, and the farm encryption key is not changed. The Passphrase value must be the same on all servers in the farm if the farm is to function correctly. So if the Passphrase fails to propagate to all servers, the LocalServerOnly parameter can be used to set the remaining servers to the new Passphrase value manually.
Note: I would prefer to change the PassPhrase globally because if it is not same on all server then farm will experience the problem

Parameter

  • ConfirmPassphrase (Required,System.Security.SecureString): Passphrase is typed a second time to confirm that it matches the first entry.
  • Passphrase(Required,System.SecuritySecureString): Specifies the new Passphrase value.
  • LocalServerOnly(Optional,System.Management.Automation.SwitchParameter): Scopes the Passphrase change to the local server only. If this parameter is not used, the Passphrase change is performed farm-wide. 
    • Only use if you sure only one server don't have correct passPhrase.
  • Confirm (Optional,System.Management.Automation.SwitchParameter): Prompts you for confirmation before executing the command. For more information

Example


$passphrase=ConvertTo-SecureString -asPlainText -Force

Set-SPPassPhrase -PassPhrase $passphrase -Confirm
This example asks for a passphrase string and sets the farm passphrase to a new value. something looks like this:


Start-SPAdminJob


All administrator should know about this command because many times deployment of solution or retraction of solutions stuck on one server. Or sometimes we want to execute the admin jobs immediately rather wait for schedule. 
Use the Start-SPAdminJob cmdlet to execute all administrative timer jobs immediately rather than waiting for the timer job to run.
When the service account for the SharePoint 2010 Administration service (SPAdminV4)) is disabled (necessary in some installations for security reasons), the Start-SPAdminJob cmdlet must be run on all computers to perform an administrative task like provisioning. If SPAdmin is healthy then you may get any error.

Parameter


  • AssignmentCollection (Optional,Microsoft.SharePoint.PowerShell.SPAssignmentCollection)Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
    NoteNote:When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.
  • Confirm (Optional,System.Management.Automation.SwitchParameter): Prompts you for confirmation before executing the command. For more information

Example


Start-SPadmin

This command will run all the waiting jobs immediately.

Start-SPadmin -verbose
This command will run all the waiting jobs immediately and show the verbose output, like this:

Error:


If Admin Service is in healthy state and working without issue then you may get the following error:

This is kind of expected behaviour and in this case, you have to stop the spadminv4 service then execute the start command. like this.

net stop SPAdminV4
Start-SPAdminJob
net start SPAdminv4

Reference:


See Also:


New-SPCentralAdministration​
This example will create the central admin web on the local Server, on a randomly pick non-used port along with NTLM authentication.

New-SPCentralAdministration​ -port 1243
This example will create the central admin web on the local Server at port # 1243 along with NTLM authentication.
New-SPCentralAdministration​
This example will create the central admin web on the local Server, on a randomly pick non-used port along with NTLM authentication.

New-SPCentralAdministration​ -port 1243
This example will create the central admin web on the local Server at port # 1243 along with NTLM authentication.