Reputation: 1614
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"
}
}
}
Upvotes: 1
Views: 543
Reputation: 301147
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
Upvotes: 4