$ 0 0 if (($foo -Contains 'X') -or ($foo -Contains 'Z')) {Write-Output $foo} Should give you what you expect.