Installing updates

Once the applicable updates are identified, the next step for managing updates on the client is to install the updates themselves. This process involves confirming the updates are necessary, downloading the updates, and installing the updates.

Getting ready

This recipe is similar to the prior recipe in that it starts by searching for missing updates on the local system. This list of missing updates is then used to initiate the download and installation of these updates.

How to do it...

The updates can be installed through the following steps:

  1. Set up the necessary update client objects:
    $searcher = New-Object -ComObject Microsoft.Update.Searcher $updateCollection = New-Object -ComObject Microsoft.Update.UpdateColl $session = New-Object ...

Get Windows Server 2012 Automation with PowerShell Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.