How to see if a Windows Update KB is Installed
There are multiple ways to verify if a KB is installed on a device (or not). Sometimes there are issues reported that Automox is reporting a KB as installed when it doesn't appear to be on the device! The best way to see if a KB is installed is to follow this article:
How to Check if a Windows Update (KB) is Installed on your Computer?
Keep in mind that each method does not verify all of the KBs installed (completely). Some methods show different KBs than others. Therefore, all methods must be explored to rule out whether a KB is indeed installed or not.
We use this command to determine if a KB is installed on a device:
#ran second
Get-Hotfix | ForEach-Object {
$kb = $_.HotFixID
if ($kb -NotMatch ".*(KB\d{6,7}).*")
{
# HotFixID is not a KB
return
}
$kb = $Matches[1] # this is the first capture group from the previous match/notmatch query
#createAutomoxPackage [id] [secondaryID] [displayName] [version] [updateSource] [rebootRequired] [category] [severity] [isManaged]
$pkg = createAutomoxPackage $_.HotFixID $_.HotFixID "$($_.Description) ($kb)" $null "WindowsHotfix" $null $null $null $([int]$GSoftwareManaged)
$qfeMap[$kb] = $pkg
}
#ran first
Function getOSArch()
{
Try
{
if ($script:arch -eq $null)
{
#$prop = $env:PROCESSOR_ARCHITECTURE
$prop = (Get-ItemProperty -Path HKLM:'\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name 'PROCESSOR_ARCHITECTURE').PROCESSOR_ARCHITECTURE
if ($prop -like '*64*')
{
$script:arch = 64
}
else
{
$script:arch = 32
}
if ($script:arch -eq 64)
{
$script:archs = @(32, 64)
}
else
{
$script:archs = @(32)
}
}
return $script:arch
}
Catch
{
#couldn't determine os arch
Throw
}
}
...but, whatever Automox reports is installed is from direct communication from the device (the device's response). Automox can only report what the device says.