Microsoft Update Health Tools, and PSWindowsUpdate

article #1455, updated 14 days ago

The Microsoft Update Health Tools appears to be an optional add-on which helps Windows do updates. Beyond that all of my searching has come up with vagueness. But Microsoft recommends it and often installs it without informing us, so probably it helps fairly often.

Microsoft Update Health Tools comes in KB4023057. To install KB4023057, we can use PSWindowsUpdate:

www.business.com/articles/install-windows-patches-powershell/

Here’s a complete run-anywhere command paste for preparing to use the module:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
set-executionpolicy bypass -scope process -force
# Get repository
If (-not (Get-PSRepository -Name PSGallery)) {
	Register-PSRepository -Default |& Out-Null
}
# Get latest version of package provider
$NuGetLatest = (Get-PackageProvider -ListAvailable -Name NuGet).Version
# Get version of currently installed package provider
$NuGetInstalled = (Get-PackageProvider -Name NuGet -Force).Version
If ($NuGetLatest -ne $NuGetInstalled) {
	Install-PackageProvider -Name NuGet -Force
}

If (Get-InstalledModule -Name PsWindowsUpdate) {
	Update-Module -Name PSWindowsUpdate -Force
} Else {
	Install-Module -Name PSWindowsUpdate -AllowClobber -Scope CurrentUser -Force
}
Import-Module PSWindowsUpdate

and the command for just KB4023057:

Install-WindowsUpdate -KBArticleID KB4023057

PSWindowsUpdate is a very interesting module all by itself, it can do lots of things, e.g., install all updates available from Microsoft. Another nice function is:

Reset-WUComponents

To get a full list of functions:

Get-Command -Module PSWindowsUpdate

Get-Help works for all of them.

One can install all updates available from Microsoft, though this can be dangerous, there are huge ones and drivers and BIOS too. So this simple command won’t be here :-)

To just see the list of available updates:

Get-WindowsUpdate

To install all available updates except one KB:

Install-WindowsUpdate -AcceptAll -NotKBArticleID KB000000

and except a list (here of two) KBs:

Install-WindowsUpdate -AcceptAll -NotKBArticleID "KB000000,KB000001"

where KB000000 is a KB to be excepted. There’s also -NotCategory and -NotTitle for items without KB articles.

Categories: