Pergunta

I am trying to check a list of computer and see if what patches they are missing, this is been giving me trouble for some reason. I'm sure im overlooking something simple but help would be greatly appreciated please and thank you.

$Computers = "TrinityTechCorp"
$HotFixes = Get-Content HotFixes.csv

ForEach ($Computer in $Computers) {
    $Comparison = get-hotfix -ComputerName $Computer | Select HotFixID
    ForEach ($HotFix in $HotFixes) {
        IF ($Comparison -NotLike "*$HotFix*") {
            Write-Host "$Computer missing $HotFix"
        }
    }
}
Foi útil?

Solução

From

$Comparison = get-hotfix -ComputerName $Computer | Select HotFixID

$Comparison will be collection of objects with HotFixId properties.

If you want them as a collection of strings, you have to do:

$Comparison = get-hotfix -ComputerName $Computer | Select -expand HotFixID
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top