문제

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"
        }
    }
}
도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top