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:
Set up the necessary update client objects:
$searcher = New-Object -ComObject Microsoft.Update.Searcher $updateCollection = New-Object -ComObject Microsoft.Update.UpdateColl $session = New-Object -ComObject Microsoft.Update.Session $installer = New-Object -ComObject Microsoft.Update.Installer
Search for missing updates:
$searcher.online=$true $searcher.ServerSelection=1 $results = $searcher.Search("IsInstalled=0")
Create a collection of applicable...