Posted On February 9, 2022

PowerShell: Check Windows Computers for Specific KB’s

kimconnect 0 comments
blog.KimConnect.com >> Codes , Windows >> PowerShell: Check Windows Computers for Specific KB’s
# 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 

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

How to Repair Windows Using CD or USB flash drive

Scenario 1: after PAEPATCH 32Bit Windows to use more than 3.5 GB or RAM, sometimes…

NGINX

# Create nginx.repovim /etc/yum.repos.d/nginx.repo#### content ####[nginx]name=nginx repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=0 enabled=1###############sudo yum update nginxsudo service nginx…

PowerShell: Gather Information About Windows Shutdown Reasons

Copy and Paste this to See Result(s): $computername=$env:computername $limitEventsCount=40000 $daysSearchLimit=30 function getWindowsShutdownReason{ param( $computername=$env:computername, $limitEventsCount=10000,…