Hi Guys.
I could really use some help on a script I am working on. I am trying to query a bunch of servers for a particular hotfix and return whether it is installed or not.
Unfortunately I can't quite get this working and I'm struggling to see where I am going wrong. each time I run the script it prompts me for the server list, then for the Hotfix KB number but then returns that the hotfix is not installed on each of the listed servers even though I know it is installed.
My code is:
cls
$HF = (read-host "Please enter hotfix ID?")
function Get-HotFix {
BEGIN {}
PROCESS {
$HF1 = $HF
$Name = (gwmi win32_operatingsystem -ComputerName $_).csname
$results = gwmi -Query "select * from win32_quickfixengineering"
if ($results -match $HF1) {Write-Host $HF1 "is installed on" $Name }
else {Write-Host $HF1 "not installed on" $Name }
}
END {}
}
gc (Read-Host "Enter Server List") | get-hotfix
Can anyone see what I am doing wrong?
Thanks
Lee