Tuesday, May 17, 2016

Check Windows Updates

sometimes you need to check does a server has a update, here the powershell script:
param ($myServer,$myHotFix)
$kb=$false
$myKBs=icm $myServer {get-hotfix}
foreach ($item in $myKBs)
{
    if ($item.HotFixId -eq $myHotFix){
        $item
        $kb=$true}
}
if ($kb -eq $false) {write "No such KB"}


It can be checked from one line:
icm "servername" {get-hotfix|where {$_.HotFixId -eq "KBnumber"}}


No comments:

Post a Comment