Having trouble with my loop:
$array =@();
foreach($list in $Lists | Where-Object{"History", "Historic" -notmatch $list.Title})
{
$result = new-object psobject
$result | Add-Member -MemberType noteproperty -Name Title -value $list.Title
$array += $result
Write-Host $list.Title
}
I want to save only the results which don't contain "History" or "Historic" in their title.
For example "Workflow blablabla - Historic" wouldn't be saved.
Can't find the right syntax of my condition: returns all results or nothing at all.