SharePoint 2016 farm configuration using PowerShell

With the arrival of SharePoint 2016, farm configuration changed a bit. A new feature was added which allows you to choose the role of the server when you create a new SharePoint farm, or when you are joining a server to an existing farm. This feature is called MinRole. In PowerShell, there are 2 cmdlets which are involved in the creation of a farm or in the joining in an existing farm.

These cmdlets have a new parameter -LocalServerRole which accepts a Microsoft.SharePoint.Administration.SPServerRole value.

I created 2 complete scripts which use these cmdlets. These scripts have a parameter -SPVersion which accepts 3 values: 2010, 2013, and 2016. This makes these scripts usable for SharePoint 2010, 2013, and 2016. When 2016 is specified, the user will be prompted to select the role.

Update 04/10/2016 : The Join-Farm script has been updated. After adding a server to a farm, there are 2 services which are not started immediately:

  • SharePoint Timer Service
  • App Fabric Caching Service

The script has been updated to check for these services and will start them if needed. The App Fabric Caching service is obviously only started if the server has been chosen to be a distributed cache host.

Update 10/11/2016 : I have updated the scripts below somewhat.

  • They now include the extra 2 server roles which came with Feature Pack 1.
  • The parameters are changed to be a bit more dynamic. For example, you now have a switch parameter to indicate if it’s a 2010, 2013 or 2016 farm. Depending on that switch, a different set of parameters is applicable.

Farm Configuration Script

Join Farm Script

 

10 thoughts on “SharePoint 2016 farm configuration using PowerShell

  • Pingback: DistributedCache Server role vs SkipRegisterAsDistributedCacheHost

  • Thursday, 6 October, 2016 at 03:11
    Permalink

    Bart,

    is it good idea to make option to host Central Administration in Join Script as Yes or No to host CA.

    • Thursday, 6 October, 2016 at 09:48
      Permalink

      It can be done since it’s just provisioning or deprovisioning the Central Admin Service on the new server. But there are some additional steps to be completed as well. You need to update the AAM for CA because this is not changed automatically. And you need to change the URL for CA in the registry on all farm servers to point to the new server. So, there’s a little more to it than just starting the service. But it can be done. Spencer Harbar has an article on what you need to do to change CA to a different server.

  • Wednesday, 5 October, 2016 at 13:30
    Permalink

    Thank U for the reply Bart,

    1.when i executed this script there was no errors everything was fine but when i go and check the Appfabric service its not started and i tried manually to start using (start-service AppFabricCachingService -PassThru) showing error as cannot start the service in this computer
    2.”Microsoft SharePoint Foundation Administration”,”Microsoft SharePoint Foundation Timer both services” not started in “Services in Server” page the status showing empty
    (Timerservices status showing Running(checked By PowerShell)

    • Wednesday, 5 October, 2016 at 14:48
      Permalink

      What is the state of these services after a reboot of the server?

      • Wednesday, 5 October, 2016 at 15:40
        Permalink

        Bart,

        Below are the services running in this server also there is one more Front end server apart from it in both servers running same services, in both servers Central Administration running is that common in Min Role topology ? as i said earlier “SharePoint Foundation Administration”,”Microsoft SharePoint Foundation Timer” status is empty after reboot…

        Claims to Windows Token Service Started
        Microsoft SharePoint Foundation Web Application
        Central Administration
        Application Discovery and Load Balancer Service

  • Tuesday, 4 October, 2016 at 10:53
    Permalink

    Hi Bart,

    I have connected new wfe server and i selected YES option when it asks to host Distributedcache but after the server ready when i check the services it just running WFE services only not running Distributed Cache service, please let me know if anything missing.

    Best Regards,

    Shan

     

     

    • Tuesday, 4 October, 2016 at 11:27
      Permalink

      Hello Shan,
      this is correct. You will probably notice also that the SharePoint Timer Service is not started as well. I noticed the same thing last week. I have already updated the Join-Farm script to start both services after adding the server to the farm, if they are stopped. I haven’t had the chance to update the post yet with the updated version of the script. I will do this today. Thanks for reminding me. 🙂

      • Thursday, 27 October, 2016 at 18:47
        Permalink

        is this scripts up to date?

        • Sunday, 30 October, 2016 at 00:33
          Permalink

          Yes, they are up to date. But they will be updated when Feature Pack 1 is released to include the combined server roles.

Comments are closed.