You are close.
Your code as posted has a couple errors in it. Given you provided output, you probably just forgot to include the wildcards to your searches.
Get-MsrcCvrfDocument -ID 2022-Nov | Get-MsrcCvrfAffectedSoftware | Select-Object FullProductName,CVE,KBArticle | Where {$_.FullProductName -like “*server*” -and $_.FullProductName -notlike “*core installation*” -and $_.KBArticle -like “*KB5019966*”}
You are wanting to find 4 KBs. There are two options for you.
Option 1.
Since you are only looking for 4 KBs, you could just change your -and $_.KBArticle -like into a series of
$_.KBArticle -like "*search string* -or
and repeat till you have all 4.
Here is the about Operators documentation. This is for PS 5.1, but you can select whatever version of PS you are using.
about Operators - PowerShell | Microsoft Learn
Here is some Operator Precedence documentation, again select for the version of PS you are using
about Operator Precedence - PowerShell | Microsoft Learn
Option 2.
Use a foreach loop. This is a bit over kill for just trying to find 4 KBs in a onetime scenario. However, if you wanted to make your script easier to reuse with a varying number of KBs, this could be one way to go. Create a simple text file with the list of KBs, put that list into a variable, then run it through a foreach loop.
Here is the documentation for using a foreach loop
about Foreach - PowerShell | Microsoft Learn
Here is documentation for getting contents of a text file
Get-Content (Microsoft.PowerShell.Management) - PowerShell | Microsoft Learn
Give the -or operator a try, but if you run into any issues, let me know. I did test this approach to double check everything, so it works. As long as you don’t forget the wild cards for your -like searches, you only need to play with the below section of your script.
-and $_.KBArticle -like “*KB5019966*”