Devices with a specific installed KB

Devices with a specific installed KB

Written by Ines

Last published at: October 6th, 2021

PS Script

Script Events:

  1. Discovers all devices
  2. Discovers their inventories and extrapolates all installed updates, and then filters the specific one
  3. Returns all results

Script example:



$serverURI = 'server'

$KB = 'KB4574727'


$creds = Get-Credential

Connect-TSTMGMTServer -Uri $serverURI -Credentials $creds

$Devices = Get-TSTMGMTDevices

$Results = foreach ($D in $Devices) {

    $D | Get-TSTMGMTDeviceInventory | Select -ExpandProperty InstalledWindowsUpdates | where {$_.KB -eq $KB} | select -Last 1 @{n='Device';e={$D.DeviceName}},

    @{n='Product';e={$D.ProductType}}, KB, Name, DateApplied | sort DateApplied -Descending 


$Results | ft

TSQL variation

Script Example:


select distinct DE.DeviceName, WU.KB, WU.Name, Wu.DateApplied, 

'ProductType' = CASE

WHEN DE.ProductType = 0 THEN 'TK'

WHEN DE.ProductType = 4 THEN 'SRW'


from WindowsUpdates WU

inner join Devices DE on WU.DeviceId = DE.DeviceId

where WU.KB = 'KB4574727'