Thursday, August 21, 2014

SharePoint 2013: How to install updates using PatchIt

Introduction

Patching can take longer on SharePoint 2013 than previously experienced with 2010.  Use Russ Maxwell's PowerShell script to significantly reduce the amount of time consumed by patching SharePoint.  This posting presents the simple steps necessary for using his script and includes AlsTechTips notes from the field.  A few words of caution: be sure to read through the Notes section, as there are some limitations regarding this script that can be confusing to troubleshoot.

Procedure
  1. Preparation
    1. Login to a SharePoint server using any administrator account. 
    2. Copy the update executables to a local folder on each server hosting SharePoint Server 2013.  Call it updates.
    3. Add another folder off the root system drive.  For this posting, the new folder is called patchit.
    4. Copy the script file PatchIt.PS1 to this folder.
    5. Logout of the machine.
    6. Repeat this for each server in the farm hosting SharePoint Server 2013.
  2. Installation
    1. Logon to the first WFE using the SharePoint Setup User Administrator account (eg, spAdmin).
      NOTE: it is imperative that you login using this account and perform the update installation using this account.  Not doing so may introduce subtle inconsistencies into SharePoint operations that may lead to odd and confusing behavior difficult to troubleshoot and resolve.
    2. Copy the first update executable to the folder containing PatchIt.PS1. 
      NOTE: only one update executable can be in this folder at a time.  PatchIt can only install one update at a time.
    3. Launch the SharePoint Management Shell with elevated privilege (as administrator).
    4. Navigate to the patchit folder containing PatchIt.PS1.
    5. Execute the following:
      .\PatchIt.PS1
      After a few moments, you may be presented with the usual licensing terms prompt
    6. Check the box, and then click Continue.
    7. A new prompt will appear, Open File - Security Warning, requesting permission to run the file.
    8. Click Run.  You will see various messages appearing in the shell, as Search and other services stopped; then the patch is installed; and then Search is started.
    9. Repeat for each update that needs to be installed.
    10. Logoff
    11. Repeat for each SharePoint Server that needs to be updated.
      NOTE: check SharePoint services on each server, after completing update installation.  Also check to be sure that any paused crawls are resumed.  I have found that I sometimes need to start services and resume crawls after installing updates using PatchIt.
References
Notes
  • Thanks to Russ Maxwell for making this outstanding script available to the SharePoint IT community.
  • If the Search Service application is not installed, there's no need to choose option 1 after launching PatchIt.  If you do, you'll see the error, You cannot call a method on a null-valued expression.  But don't worry: this error can be ignored, as the script will proceed past this.
  • If you see the following error message appear in the management shell,
    get-process : Cannot find a process with the name "[process name]". Verify the process name and call the cmdlet
    don't worry: it just means that the update is already installed or unnecessary.
  • If, after installing updates, you launch the SharePoint Products Configuration Wizard, and the Wizard informs you that a patch hasn't been installed that you know you just now installed using PatchIt, don't worry: 1) exit the Wizard; 2) manually install the update by right-clicking on it and choosing Run as Administrator; run through the entire process: it will eventually inform you that it doesn't need to be installed; that's OK: when you close that last prompt, the system will be updated to recognize that the path was installed; and finally step 3), re-run the Products Configuration Wizard.
  • If that doesn't work, exit the SharePoint Products Configuration Wizard, open an elevated SharePoint Management Shell, and then execute: Get-SPProduct -Local.
  • Listed below are times and durations captured for a typical update session.  Start was 7:30 PM
    • WFE1 (1:05hr)
      • Preparation: 7:30PM (20m)
      • KB2880994: 7:50PM (13m)
      • KB2881034: 8:01PM (8m - not installed)
      • Review: 8:10PM (15m)
      • KB2760319: 8:25PM (5m)
      • KB2880998: 8:30PM (11m)
      • Reboot: 8:31PM (2m)
      • Run WU: 8:35PM (2m)
    • WFE2 (45m)
  • get-process : Cannot find a process with the name "...". Verify the process name and call the cmdlet again...  If you see this error message, it's OK, but you have some work ahead of you, since most likely your web application will be down.  Completely down.  The reason being that PatchIt shut everything down, but then failed to start things back up after it encountered this error.  So.... you need to start everything back up again.  On application servers - and particularly the one hosting CA:
    1. Start the Windows Process Activation and World Wide Web Publishing Services.
    2. Start all application pools
    3. Start web applications
    4. Start Service Bus Gateway and Service Bus Message Broker services.
    5. Check the WFEs also, but likely they're OK - you only need to check on those servers on which the error was generated.

No comments: