I'm trying to remove items from an array that match special keywords. My array looks something like this:
$Printers =@('Printer Phone', 'Printer Building1', 'Printer XML', 'Printer Station', ...)
I want to remove all entries that match parts of certain strings, like filtering out every item that has "Phone" or "XML" in it's value. I thought of something like this but I'm not quiet sure if I'm on the right track:
$contains = @('Phone', 'XML')
$Printers -Filter * | Where-Object { $contains -contains $_.name }
Is there a simple way to achieve this?