# Check for specific KBs
$kbs='KB5010790','KB5010419'
$computernames=@('WINDOWS001','WINDOWS002')
$regexIP = [regex] "\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
$names=foreach($computername in $computernames){
if($computername -match $regexIp){[System.Net.Dns]::GetHostByAddress($computername).hostname}else{$computername}
}
invoke-command -scriptblock {
param($kbs)
$result=get-hotfix|?{$_.HotFixID -in $kbs}
if($result){
[hashtable]@{$env:computername="Passed: $($result.HotFixID -join ',')"}
}else{
[hashtable]@{$env:computername='Failed'}
}
} -Args @(,$kbs) -computername $names
February 9, 2022February 9, 2022
0 Comments