Screenshot
Code
Clear-host Function Get-KBs { $cmdOutput = Invoke-Expression "wmic qfe list" $cmdOutput = $cmdOutput[1..($cmdOutput.length)] foreach ($item in $cmdOutput) { if ($item) { $item = $item -replace 'Security Update','Security-Update' $item = $item -replace 'NT AUTHORITY','NT-AUTHORITY' $item = $item -replace '\s+',' ' $item = $item -split ' ' New-Object -Type PSObject -Property @{ HotFixID = [string]$item[3] } } } } Get-KBs