Creating a package for installing Internet Explorer 11, which has a number of security updates to install first as prerequisites (https://support.microsoft.com/en-us/kb/2847882).
To check if one hotfix is installed, I know I can use the following line of code, then check if the variable is not null or not empty:
$hotfix_installed = (Get-Hotfix | where {$_.HotFixId -like “KB2929437”})
I’m wondering if there’s a more efficient way of doing this than simply calling that line of code X number of times and just changing the KB number?
Example:
$hotfix_installed = (Get-Hotfix | where {$.HotFixId -like “KB2929437”})
$hotfix_installed = (Get-Hotfix | where {$.HotFixId -like “KB123456”})
$hotfix_installed = (Get-Hotfix | where {$_.HotFixId -like “KB345678”})
Because if my thinking is correct, if I call that same line of code X number of times, that seems a waste of processing time/power as opposed to calling the code once. Essentially, I think it’s the difference between saying “Check all updates installed and see if this one update is part of the list, then I’m going to do that all over again, then again, then again, etc.” vs. “Check all updates installed one time only and see if these X number of updates are part of the list”.
Thanks!