Wednesday, October 11, 2017

Zero Downtime Patching in SharePoint Server 2016


Recently needed to do an update of eight farms for a client.  Now I can never do as thorough of a job as Microsoft and others have done describing the process so I will not even attempt it. (see also links at bottom).

What I needed was a way to walk through the whole phase as simply as possible so I wrote and/or borrowed code for a PowerShell script to streamline the process

Basic steps of the script
  1. Copy updates to all servers in farm
  2. Prompt user to remove a web front end (WFE) user from Network Load Balancer(NLB)
  3. Enable Side By Side SharePoint code on that WFE
  4. Trigger the coping of Side By Side files to the c:\program files\common files\microsoft shared\web server extensions\16\template\layouts\{current SharePoint version number}
  5. Prompt user to install patch on this WFE (may possibly automate this) and reboot server
  6. Prompt user to add WFE back into NLB and remove other WFE (could add a loop for more than 2 WFE)
  7. Enable Side by Side on second WFE
  8. Trigger SharePoint file copy
  9. Prompt to install patches on second WFE and reboot server
  10. Disables the Distributed Cache(DC) on the first server designated with the "DistributedCache" role
  11. Prompts user to install patched on this server and reboot.
  12. Re-enables the distributed cache on this server
  13. Disables the DC on the second server
  14. Prompts to install patches and reboot server
  15. Re-enables the distributed cache on this server
  16. Runs database upgrade on all content databases
  17. Runs PSConfig on each server one at a time maintaining availability of all services
  18. Set Side By Side to the new version that has just been installed on all servers

Command Line

PS> .\SP-UpdateFarm.ps1 -farmaccount "test\test-farm" -weburl "https://test-partner.example.com/" -wfeSvr01 "TESTWFE01" -wfeSvr02 "TESTWFE01" -otherSvrs01 @( "TESTAPP01", "TESTSRCH01", "TESTDCS01") -otherSvrs02 @( "TESTAPP02", "TESTSRCH02", "TESTDCS02") -test $true

Parameters

[string] $farmaccount  ="The Farm account to connect to SharePoint"
[string] $weburl ="Web application URL to the use for upgrading"
[string] $wfeSvr01 = "Name of the first Web Front End"
[string] $wfeSvr02 ="Name of the Second Web Front End"
Array $otherSvrs01="Other servers in your HA farm all 01"
Array $otherSvrs02 ="Other servers in your HA farm all 02"
[string] $patchFolderUNC ="UNC to copy the upgrade files from"
[string] $patchInstallFolder="The folder to place the upgrade files in on remote servers"
[bool]$test ="run through script connecting to servers but not actually performing actions"

Gotchas

  • if you have a folder in the "web server extensions\16\template\layouts" folder that looks like a version number for example 1.2.3.4 it can be deleted when you enable the Side By Side
  • remote powershell must be allowed for this to work
  • you must run as Farm account
  • PowerShell must be run as Administrator

SP-UpgradeFarmZDP.ps1



See also:
https://technet.microsoft.com/en-us/library/mt767550(v=office.16).aspx
https://technet.microsoft.com/en-us/library/mt743024(v=office.16).aspx
https://blogs.technet.microsoft.com/pla/2016/03/10/zero-downtime-patching-in-sharepoint-server-2016/
https://technet.microsoft.com/en-us/library/cc748824(v=office.16).aspx