Updated 5 Hour SharePoint Patch Script

Russ Maxwell created a SharePoint 2013 patch script that prevented the binary patching process from taking quite a few hours to complete. This has come to be affectionately known as the ‘5 hour SharePoint patch script’.

It’s a great script and I’ve used it many times with many customers. However, it does not handle SharePoint Server 2016 and I wanted to make a few minor adjustments. So I updated the script and put it on GitHub! The updated script handles both SharePoint 2013 as well as SharePoint 2016. Another improvement is handling multiple patches located in the same directory (obviously this does not mean multiple Cumulative Updates for SharePoint 2013 due to the cab files). This will allow you to apply multiple SharePoint 2013 patches (e.g. security patches or hotfixes, or a mix thereof) as well as allowing you to place both the sts and wssloc executables for SharePoint Server 2016 in the same directory and have the patch process complete for both without having to run the script twice.

As with Russ Maxwell’s original script, drop the executables (and .cab files if it is a SharePoint 2013 Cumulative Update) into the same folder as the SharePointPatchScript.ps1. Run Powershell (or the SharePoint Management Shell) ‘As Administrator’ and it will ask you if you want to pause or stop the Search Service (this will affect all Search Service Applications on the farm). From there, it will perform a silent installation.

You can go grab it on GitHub at https://github.com/Nauplius/SharePoint-Patch-Script/. Feel free to pass on suggestions for this local patch script or even make pull requests to improve upon it. But more improvements from my side are to come. The current list is:

  • Do not resume Search
  • Make into a PowerShell Module – this would allow for parameter passing in a friendly manner
  • Specify the patch path, rather than having to place the patch in the same directory
  • Better informational messages about what the script is doing

Let me know if you have any other thoughts!


  1. Great improvements to an already good tool! In my environment, I found that I did have to make three changes to get it to execute/work:
    1. Major version: removed the .ToString() to get the correct value.
    2. OSearch$majorVersion: kept erring out when looking for service (“OSearch”). Changed to “OSearch$($majorVersion)”
    3. When setting $filename: modified to include file path: $filename = $path + “\” + $patchfile.Basename.

    Again changes made in my environment to get it to work; could be the pilot of the keyboard on this end.

    Keep up the great contributions!


  2. An another change : line 215 : Put $Stopped in “if($Stopped -and ($Resume))” instead of $Stop because search service are always stopped.

    Nice script !!


Leave a Reply